Consider: int g (void); void h (int, int); void f (int b) { int x, y; if (b) { x = g (); y = g (); } while (g ()) if (b) { h (x, y); y = g (); } } Compiling this program with "-O -Wmaybe-uninitialized -c" yields: tst.c: In function ‘f’: tst.c:17:9: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized] h (x, y); ^~~~~~~~ Note that x and y play a symmetric role here, except that y has an additional assignment, and this assignment makes GCC think that y may be used uninitialized! Indeed, if one removes this assignment, the warning disappear.
Confirmed (also with -O2). Older compilers need -Wuninitialized to trigger it. [WORKLIST]: add to initial list: x_22 = PHI <x_6(D)(11), x_10(3)> [WORKLIST]: add to initial list: y_21 = PHI <y_7(D)(11), y_12(3)> [CHECK]: examining phi: y_21 = PHI <y_7(D)(11), y_12(3)> [CHECK]: Found unguarded use: y_18 = PHI <y_21(4), y_16(6)> [WORKLIST]: Update worklist with phi: y_18 = PHI <y_21(4), y_16(6)> [CHECK]: examining phi: y_18 = PHI <y_21(4), y_16(6)> [CHECK] Found def edge 1 in y_21 = PHI <y_7(D)(11), y_12(3)> [CHECK] Found def edge 1 in y_18 = PHI <y_21(4), y_16(6)> [CHECK]: Found unguarded use: h (x_22, y_18); [CHECK]: examining phi: x_22 = PHI <x_6(D)(11), x_10(3)> [BEFORE SIMPLICATION -- [DEF]: it's confused by the CFG structure it seems.