Spurious warning in gcc SVN trunk
Ian Lance Taylor
iant@google.com
Tue Aug 11 16:27:00 GMT 2009
"Kevin P. Fleming" <kpfleming@digium.com> writes:
> Compiling this as follows:
>
>> $ ~/gcc-trunk/bin/gcc -o test test.c -Wall
>> test.c: In function ‘main’:
>> test.c:23:4: warning: jump skips variable initialization
>> test.c:11:2: note: label ‘TEST_LABEL’ defined here
>> test.c:9:9: note: ‘foo’ declared here
>
> While this warning is completely accurate, it's also spurious, because
> the code that will execute after the jump to TEST_LABEL does not
> reference the local variable 'foo' in the target block at all.
>
> Now, I don't expect anyone to like this code... I've already fixed it up
> to not be so horrifically bad, but it's still perfectly valid and should
> not generate such a warning. Comments?
This was the subject of a long discussion over on gcc@gcc.gnu.org, which
ended here:
http://gcc.gnu.org/ml/gcc/2009-06/msg00704.html
If you have something new to contribute, please do.
Ian
More information about the Gcc-help
mailing list