https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93432
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c |tree-optimization Keywords|easyhack | --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- It works by chance when optimizing but not optimizing too much. -O3 unrolls the loop and runs into CCP aka PR18501, we get <bb 2> [local count: 97603129]: if (y_5(D) <= 9) goto <bb 18>; [33.00%] else goto <bb 19>; [67.00%] <bb 18> [local count: 32209032]: _11 = z_6(D) + 1; <bb 19> [local count: 97603129]: # prephitmp_17 = PHI <2(2), _11(18)> and CCP says _11 is UNDEFINED and merges it with 2 to 2. For me even GCC 9.3.1 warns, so does GCC 7.5, both even with -O3. We do not warn at -O0 but that's by design - we think doing the predicate based uninit analysis early (on the unoptimized IL) would be too noisy.