https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114923
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Escape means something different from memory being written.
In C (and C++), memory writes to some variable is modeled such that it is not
known to write to another location
So you need to add a compiler barrier here.
Note `atomic_signal_fence (memory_order_relaxed)` might be enough. Note also
the order of the writes to reg1 and reg2 might happen in a different order in
HW so you need to have a full (HW) write barrier between them to make sure the
write is done in the correct order.