https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68755
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Markus Trippelsdorf from comment #7) > --param=allow-store-data-races=1 fixes the issue. > With --param=allow-store-data-races=0 even 4.9 generates wrong code. That sounds backwards btw. It's predictive commoning performing the code motion but the load is still guarded by the header copy check (so it's a valid transform). Only sth at the RTL optimization stage then hoists the load before the if. AFAIK it's ifcvt2 and -fno-if-conversion2 fixes it.