int f(int x) { int y; if (x == 42) y = 23; return y; } This simple function results in no warning about the possibly uninitialized local variable 'y' when using the following compiler versions (compiler flags: -O -Wall): GCC 4.1.2 20070205 GCC 4.2.0 20070214 GCC 4.3.0 20070209
The warning is correctly reported by GCC 2.95.3, GCC 3.4.6 20060305 and GCC 4.0.4. -- Summary: Missing "warning: '$FOO' may be used uninitialized in this function" in trivial case Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: christoph dot mallon at gmx dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30856