[Python-Dev] Compiler warnings

Thomas Wouters thomas at xs4all.net
Tue Jan 31 11:59:20 CET 2006


I noticed a few compiler warnings, when I compile Python on my amd64 with
gcc 4.0.3:

Objects/longobject.c: In function ‘PyLong_AsDouble’:
Objects/longobject.c:655: warning: ‘e’ may be used uninitialized in this function
Objects/longobject.c: In function ‘long_true_divide’:
Objects/longobject.c:2263: warning: ‘aexp’ may be used uninitialized in this function
Objects/longobject.c:2263: warning: ‘bexp’ may be used uninitialized in this function

Modules/linuxaudiodev.c: In function ‘lad_obuffree’:
Modules/linuxaudiodev.c:392: warning: ‘ssize’ may be used uninitialized in this function
Modules/linuxaudiodev.c: In function ‘lad_bufsize’:
Modules/linuxaudiodev.c:348: warning: ‘ssize’ may be used uninitialized in this function
Modules/linuxaudiodev.c: In function ‘lad_obufcount’:
Modules/linuxaudiodev.c:369: warning: ‘ssize’ may be used uninitialized in this function

Those are all fairly harmless, just the compiler can't figure out that they
are never actually used when they aren't explicitly initialized, because the
initialization happens a few functioncalls deeper into the callstack. This
one:

Python/marshal.c: In function ‘PyMarshal_ReadShortFromFile’:
Python/marshal.c:410: warning: ‘rf.end’ is used uninitialized in this function
Python/marshal.c:410: warning: ‘rf.ptr’ is used uninitialized in this function

(The linenumber is off, it should be 884)
is more of the same, except you can't tell from the function that it is a
"can never happen" situation: if PyMarshal_ReadShortFromFile() was called
with NULL as fp, it would actually use the uninitialized 'end' and 'ptr'
struct members. An assert() is probably in place here.

Should these warnings be fixed? I know Tim has always argued to fix them, in
the past (and I agree,) and it doesn't look like doing so, by initializing
the variables, wouldn't be too big a performance hit.

I also noticed test_logging is spuriously failing, and not just on my
machine (according to buildbot logs.) Is anyone (Vinay?) looking at that
yet?

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!


More information about the Python-Dev mailing list