https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113106
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #1)
> Perhaps related,
>
> --cut here--
> int a;
>
> int foo(void)
> {
> return *(volatile int *) &a + *(volatile int *) &a;
> }
> --cut here--
>
> compiles with -O2 to:
>
> movl a(%rip), %eax
> movl a(%rip), %edx
> addl %edx, %eax
> ret
>
> but may be compiled to:
>
> movl a(%rip), %eax
> addl a(%rip), %eax
> ret
>
> (the memory read may propagate to the insn)
That is pr 3506