https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116912
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Just looked at `-O2` and `-O2 -fno-strict-aliasing` code generation and yes I 100% can confirm this is an aliasing issue. With -fno-strict-aliasing we get: ``` bl printf // mov x1, x20 //, pmcr_n add x0, sp, 112 //,, bl set_pmcr_n // mov x3, x20 //, pmcr_n ldr x2, [sp, 112] // pmcr.22_1, pmcr add x0, x22, :lo12:.LC37 //, tmp177, mov x1, x21 //, _58 str x2, [sp, 104] // pmcr.22_1, %sfp bl printf // ``` Which is what you wanted.