Created attachment 606160 [details] test2.c Warning about used unitialized variables depends on optimization level. The attached is a test program, which demonstrates the issue. It would be nice to not depend on optimization level here, at least in this case. This is with gcc-4.7.0-5.fc17.x86_64, and the output based on compilation is here: $ gcc -g -O0 -Wall -Wextra test2.c -o test2 && ./test2 x:1 p:2 x:0 p:3 $ gcc -g -O2 -Wall -Wextra test2.c -o test2 && ./test2 test2.c: In function ‘main’: test2.c:14:3: warning: ‘p’ is used uninitialized in this function [-Wuninitialized] test2.c:7:6: note: ‘p’ was declared here x:1 p:2 x:0 p:1
That is not a bug. Warnings that aren't reported by the frontends, but that require some optimizations for it to be performed, obviously do depend on the optimization level.
I do not understand. If you check the code, then there is no compiler optimization required to trigger the use of uninitialized variable.
The uninitialized use is (without inlining/cloning) only conditional, of the may be used uninitialized kind, and for -O0 those are never enabled, because not enough optimizations were performed to remove most of the false positives.