https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121661
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Hongtao Liu from comment #10) > (In reply to Andrew Pinski from comment #7) > > (In reply to Hongtao Liu from comment #6) > > > Looks correct in the gimple > > > > The bug only happens at -O0. At higher levels it is ok. > > https://godbolt.org/z/M979PM88a this is O2, it also prints 0. Oh maybe my reduced testcase only fails at -O0.