Bugzilla – Bug 94144
gcc: strange "is used uninitialized" reports
Last modified: 2007-06-05 12:35:39 UTC
Attached code reports following warning: unused.c: In function ‘main’: unused.c:14: warning: ‘testvar.unusedval’ is used uninitialized in this function Uncommenting "forget (testvar)" on line 15, this warning disappears, which is even more strange. The warning is invalid (should be "may be used uninitialized"), because gcc has no knowledge about forget(). Related: http://bugzilla.gnome.org/show_bug.cgi?id=308923 gcc -c -O2 -Wall unused.c ------ struct testme { int testval; int unusedval; }; extern void forget (struct testme forgotten); int main () { struct testme testarray[1]; { struct testme testvar; testvar.testval = 0; testarray[0] = testvar; /* forget (testvar);*/ } forget (testarray[0]); return 0; }
Entered as http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22197 .
Tracked upstream and will end in a future product... Marking as wontfix for 10.0