[forwarded from http://bugs.debian.org/386174]
bug submitter writes (4.1 and trunk): In the following program, gcc fails to recognize that "n" is uninitialized, unless the "sscanf" line is commented out. I expected no change at all, since sscanf() is called after foo(). Since the compiler is responsible for guaranteeing that the program runs as if this order is true (even if it is not), I expect it to be aware of the initialized state of the variables. gcc-4.1 -std=gnu99 -W -Wall -O3 -g ss.c -o ss ss.c: In function 'main': ss.c:6: warning: 'n' is used uninitialized in this function gcc-4.1 -DSS -std=gnu99 -W -Wall -O3 -g ss.c -o ss [no warning] #define _GNU_SOURCE #include <stdio.h> static void foo(size_t *n) { printf("%d\n", *n); } int main() { size_t n; foo(&n); #ifdef SS sscanf("1234", "%zd", &n); #endif return 0; } -- Summary: gcc sometimes doesn't recognize uninitialized variables Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: debian-gcc at lists dot debian dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29227