https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125250
--- Comment #4 from Drea Pinski <pinskia at gcc dot gnu.org> --- (In reply to Kael Franco from comment #3) > (In reply to XChy from comment #0) > > This testcase prints 8 at -O0, while printing 0 at -O1/2/3. > > (In reply to Drea Pinski from comment #2) > > Confirmed. Note even though the correct answer is seemly printed out in GCC > > 15.1.0, the IR there is incorrect too. > > > > The bug is in lim pass. > > r16-3374-g7269aa0765415d Yes as mentioned the ir is bogus even in gcc 15. We get a load via a bool and the bool will contain 8 which is just undefined behavior and just happen to work.
