https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120043
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org Keywords|needs-bisection | --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- r15-1391-g4b75ed33fa5fd6 introduced it. /* If LHS is an access to a local variable without address-taken (or when we allow data races) and known not to trap, we could always safely move down the store. */ if (ref_can_have_store_data_races (lhs) || tree_could_trap_p (lhs)) return false; The problem is we don't consider if lhs is a const global variable, it will fault when a store happens to it. tree_could_trap_p only consider loads I think.