From: Ian D Romanick Message-Id: <199802031705.JAA18651@sirius.cs.pdx.edu> Subject: Re: Variable might be uninitialized To: geza AT inf DOT bme DOT hu (Geza Herman) Date: Tue, 3 Feb 1998 09:05:11 -0800 (PST) Cc: djgpp AT delorie DOT com In-Reply-To: from "Geza Herman" at Feb 3, 98 04:08:13 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk > What does this compiler warning message mean: > > ' might be uninitialized' > > This only happens when I use optimization( -O2 ). My program runs > fine, but then what is this warning message? Should I look the assembly > code to check if this message is true or not? It simply means that gcc has detected some code path where the specified variable might be used before it is initialized. In the following code snip, 'x' generates such a warning: void foo( int z ) { int x; if ( z == 0 ) x = 5; printf( "%d\n", x ); } To quote the gcc documentation, "These warnings are possible only in optimizing compilation, because they require data flow information that is computed only when optimizing. If you don't specify `-O', you simply won't get these warnings." -- "Now all the people who made fun of you in high school can see what a successful freak you've become." http://www.cs.pdx.edu/~idr