[Python-Dev] Compiler warnings

Giovanni Bajo rasky at develer.com
Wed Feb 1 20:40:58 CET 2006


Tim Peters <tim.peters at gmail.com> wrote:

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

This has been discussed many times on the GCC mailing list. Ultimately,
detecting whether a variable is using initialized or not (given full
interprocedural and whole-program compilation) is a problem that can be
reduced to the halting problem. The only thing that GCC should (and will) do
is finding a way to be consistent across different releases and optimization
levels, and to produce an useful number of warnings, while not issuing too
many false positives.
-- 
Giovanni Bajo



More information about the Python-Dev mailing list