[Python-Dev] Compiler warnings

Tim Peters tim.peters at gmail.com
Wed Feb 1 03:19:41 CET 2006

>> Well, that's pretty bizarre.  There's _obviously_ no way to get to a
>> reference to `e` without going through
>>         x = _PyLong_AsScaledDouble(vv, &e);
>> first.  That isn't a useful warning.

> But how can the compiler know that it is an output-only argument?

In the absence of interprocedural analysis, it cannot -- and neither
can it know that it's not an output argument.  It can't know anything
non-trivial, and because it can't, a reasonable compiler would avoid
raising a red flag at "warning" level.  "info", maybe, if it has such
a concept.  It's as silly to me as seeing, e.g.,

recip(double z)
    return 1.0 / z;

"warning: possible division by 0 or signaling NaN"

Perhaps, but not useful because there's no reason to presume it's a
_likely_ error.

More information about the Python-Dev mailing list