https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125250
--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> --- So what happens in GCC 15, is jump threading we have: ``` a5__lsm.14_18 = MEM[(_Bool *)&a5]; ... <bb 4> [local count: 114863531]: # g9_lsm.12_29 = PHI <_7(3), g9_lsm.12_10(2)> # g9_lsm_flag.13_14 = PHI <1(3), 0(2)> # a5__lsm.14_27 = PHI <0(3), a5__lsm.14_18(2)> MEM[(_Bool *)&a5] = a5__lsm.14_27; if (g9_lsm_flag.13_14 != 0) ... ``` And then jump threading does: ``` a5__lsm.14_18 = MEM[(_Bool *)&a5]; ... <bb 4> [local count: 6317494]: # g9_lsm.12_20 = PHI <g9_lsm.12_10(2)> # g9_lsm_flag.13_12 = PHI <0(2)> # a5__lsm.14_22 = PHI <a5__lsm.14_18(2)> MEM[(_Bool *)&a5] = a5__lsm.14_22; goto <bb 7>; [100.00%] ``` And then DOM notices the store to MEM[(_Bool *)&a5] can be removed as it is the same value. But that is undefined behavior even back in GCC 15; just it was happened to remove then. GCC 16 changes the first statement to: ``` _11 = MEM[(_Bool *)&a5]; a5__lsm.14_21 = (_Bool) _11; ``` Which does not detect that they are the same value. What happened in GCC 14 and before was instead: a5__lsm.14_24 = _23(D); a5__lsm_flag.15_25 = 0; And then conditional store to a5.
