[Python-Dev] Compiler warnings

Tim Peters tim.peters at gmail.com
Wed Feb 1 02:16:21 CET 2006


[Thomas Wouters]
> 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

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.

> 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

Same thing, really, complaining about vrbls whose values are always
set by _PyLong_AsScaledDouble().

> 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 Linux bugs ;-)

> ...
> Should these warnings be fixed?

I don't know.  Is this version of gcc broken in some way relative to
other gcc versions, or newer, or ... ?  We certainly don't want to see
warnings under gcc, since it's heavily used, but I'm not clear on why
other versions of gcc aren't producing these warnings (or are they,
and people have been ignoring that?).

> 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.

We shouldn't see any warnings under a healthy gcc.

> 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?

FWIW, I've never seen this fail on Windows.  The difference is
probably that sockets on Windows work <wink>.


More information about the Python-Dev mailing list