[Python-Dev] Compiler warnings

"Martin v. Löwis" martin at v.loewis.de
Wed Feb 1 08:20:21 CET 2006


Guido van Rossum wrote:
>>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?

If a variable's address is passed to a function, gcc normally assumes
that the function will modify the variable, so you normally don't
see "might be used uninitialized" warnings. However, gcc now also
inlines the functions called if possible, to find out how the pointer
is used inside the function.

Changing the order of the functions in the file won't help anymore,
either. If you want to suppress inlining, you must put

__attribute__((noinline))

before the function.

Regards,
Martin


More information about the Python-Dev mailing list