https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97108
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2020-11-06 00:00:00 |2021-4-9 CC| |msebor at gcc dot gnu.org Known to fail| |10.2.0, 11.0, 4.7.0, 4.8.4, | |4.9.4, 5.5.0, 6.4.0, 7.2.0, | |8.3.0, 9.1.0 Keywords| |diagnostic --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Reconfirming with a slightly more simplified test case below. $ cat pr97108.c && gcc -O2 -S -Wall -fdump-tree-uninit-details=/dev/stdout pr97108.c int z; void f (int flags, int i, int j) { int x; _Bool f = !flags; if (f) x = j; if (i != 0) z = i; if (f && x != 2) z = 0; } ;; Function f (f, funcdef_no=0, decl_uid=1946, cgraph_uid=1, symbol_order=1) [WORKLIST]: add to initial list: x_18 = PHI <j_9(D)(10), x_8(D)(13)> [CHECK]: examining phi: x_18 = PHI <j_9(D)(10), x_8(D)(13)> [CHECK]: Found unguarded use: x_19 = PHI <j_9(D)(11), x_18(4)> [WORKLIST]: Update worklist with phi: x_19 = PHI <j_9(D)(11), x_18(4)> [CHECK]: examining phi: x_19 = PHI <j_9(D)(11), x_18(4)> [CHECK]: Found unguarded use: _1 = x_19 != 2; pr97108.c: In function ‘f’: pr97108.c:14:14: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 14 | if (f && x != 2) | ~~^~~~ pr97108.c:5:7: note: ‘x’ was declared here 5 | int x; | ^ void f (int flags, int i, int j) { _Bool f; int x; _Bool _1; _Bool _2; <bb 2> [local count: 1073741824]: f_7 = flags_6(D) == 0; if (flags_6(D) == 0) goto <bb 3>; [50.00%] else goto <bb 9>; [50.00%] <bb 3> [local count: 536870912]: if (i_10(D) != 0) goto <bb 10>; [50.00%] else goto <bb 11>; [50.00%] <bb 11> [local count: 268435456]: goto <bb 5>; [100.00%] <bb 10> [local count: 268435456]: <bb 4> [local count: 536870913]: # x_18 = PHI <j_9(D)(10), x_8(D)(13)> z = i_10(D); <bb 5> [local count: 805306368]: # x_19 = PHI <j_9(D)(11), x_18(4)> _1 = x_19 != 2; _2 = _1 & f_7; if (_2 != 0) goto <bb 7>; [66.67%] else goto <bb 12>; [33.33%] <bb 12> [local count: 268435458]: <bb 6> [local count: 536870914]: goto <bb 8>; [100.00%] <bb 7> [local count: 536870913]: z = 0; <bb 8> [local count: 1073741824]: return; <bb 9> [local count: 536870912]: if (i_10(D) != 0) goto <bb 13>; [50.00%] else goto <bb 14>; [50.00%] <bb 14> [local count: 268435456]: goto <bb 6>; [100.00%] <bb 13> [local count: 268435456]: goto <bb 4>; [100.00%] } Bisection indicates either r180295 or r180298 introduced the warning. Before then the dump was: ;; Function f (f, funcdef_no=0, decl_uid=1598, cgraph_uid=0) [WORKLIST]: add to initial list: x_1 = PHI <x_4(D)(3), j_5(D)(2)> [CHECK]: examining phi: x_1 = PHI <x_4(D)(3), j_5(D)(2)> Use in stmt if (x_1 != 2) is guarded by : if (f_3 != 0) [CHECK] Found def edge 1 in x_1 = PHI <x_4(D)(3), j_5(D)(2)> Operand defs of phi x_1 = PHI <x_4(D)(3), j_5(D)(2)> is guarded by : if (f_3 != 0) f (int flags, int i, int j) { _Bool f; int x; <bb 2>: f_3 = flags_2(D) == 0; if (f_3 != 0) goto <bb 4>; else goto <bb 3>; <bb 3>: <bb 4>: # x_1 = PHI <x_4(D)(3), j_5(D)(2)> if (i_7(D) != 0) goto <bb 5>; else goto <bb 6>; <bb 5>: z = i_7(D); <bb 6>: if (f_3 != 0) goto <bb 7>; else goto <bb 9>; <bb 7>: if (x_1 != 2) goto <bb 8>; else goto <bb 9>; <bb 8>: z = 0; <bb 9>: return; }