https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125132

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|builtin-memmove-12.c fails  |builtin-memmove-12.c and
                   |with --enable-default-pie   |pr122343-4a.c fails with
                   |                            |--enable-default-pie

--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Likewise for pr122343-4a.c:

extern volatile int bar;

int
foo (void)
{
  int h = bar;
  int r = bar;
  asm volatile ("barrier" ::: "memory");
  int p = bar;
  p = p + r;
  return p - bar;
}

is compiled to

        movl    bar(%rip), %eax
        movl    bar(%rip), %eax
        barrier
        addl    bar(%rip), %eax
        subl    bar(%rip), %eax

without -fpie, but

        movl    bar(%rip), %eax
        movl    bar(%rip), %eax
        barrier
        movl    bar(%rip), %edx
        addl    %edx, %eax
        subl    bar(%rip), %eax

with -fpie.

Reply via email to