[Bug c/39088] New: Warning about potential use of uninitialized variable
Following emits a warning about potential use of uninitialized variable, even though the variable initialization and it's use are guarded by the same predicate. int f (void); int g (int a) { int b; if (a) b = f (); asm volatile (#); if (a) return b; return 1; } $ gcc -O -Wuninitialized -c repro.c repro.c: In function 'g': repro.c:5: warning: 'b' may be used uninitialized in this function This happens with gcc 4.3.0 and 4.3.1 -- Summary: Warning about potential use of uninitialized variable Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: av1474 at comtv dot ru GCC build triplet: powerpc-unknown-linux-gnu GCC host triplet: powerpc-unknown-linux-gnu GCC target triplet: powerpc-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39088
[Bug middle-end/36296] bogus uninitialized warning (loop representation, VRP missed-optimization)
--- Comment #14 from av1474 at comtv dot ru 2009-02-02 23:44 --- (In reply to comment #8) Please provide a preprocessed reduced testcase as similar to the original as possible. I think this is not only predicated PHI but our representation of loops may also have something to do. I'm not sure whether following warrants a new bug entry so doing it here, sorry, if it was inappropriate. Following code, triggers: repro.c:5: warning: 'b' may be used uninitialized in this function with 4.3.0 and 4.3.1 on PowerPC when invoked like this: gcc -c -O -Wuninitialized repro.c int f (void); int g (int a) { int b; if (a) b = f (); asm volatile (#); if (a) return b; return 1; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296