[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; }
This is an old problem really. This is a dup of bug 19430. *** This bug has been marked as a duplicate of 19430 ***