https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107839
Bug ID: 107839 Summary: spurious "may be used uninitialized" warning while all uses are under "if (c)" Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net Target Milestone: --- Consider int f (int); void g (int c) { int v; if (c) v = f(0); while (1) if (c) f(v + v); } $ gcc-test -O -Wmaybe-uninitialized -c tst2.c tst2.c: In function āgā: tst2.c:4:7: warning: āvā may be used uninitialized [-Wmaybe-uninitialized] 4 | int v; | ^ All uses of v are under "if (c)", so the warning is incorrect. Note that replacing "v + v" by "v" makes the warning disappear. This occurs with GCC 8.4.0 and above up to at least 13.0.0 20220906 (experimental) from the master branch. No warnings with GCC 6.5.0 and below. Note to myself (to check once this bug is fixed): this testcase is derived from tmd/binary32/hrcases.c (warning on variable t0).