At the end of the original message I did include the command lines of three different compilations, using gcc 4.0.4, 4.1.3 and 4.2.3, all with the same basic command line: gcc -O -Wall -o foo foo.c Only the first version, gcc 4.0.4, prints the warning. Thanks, Mikael -----Original Message----- From: Tom St Denis [mailto:tstdenis@xxxxxxxxxxxxxxxx] Sent: den 29 november 2007 19:23 To: Mikael Vidstedt Cc: 'J.C. Pizarro'; gcc-help@xxxxxxxxxxx Subject: Re: Missing warning about uninitialized variable. Mikael Vidstedt wrote: > Just a quick question: Did anybody actually read the subject? My question > was not about the value of the variable, it was about recent GCC versions no > longer warn about the use of an uninitialized variable...? > You have to turn on the optimizer to see that. As I understand it, it's only when the optimizer walks down the tree that it picks up the uninitialized bit. -bash-3.00$ gcc -O -Wall -c warn.c warn.c: In function `main': warn.c:4: warning: 'g' might be used uninitialized in this function -bash-3.00$ cat warn.c #include <stdio.h> int main(int argc, char **argv) { int g; if (argc == 10) { g = 3; } printf("g == %d\n", g); return 0; } Tom