https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95750
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #7)
> Actually, x86_64 (at least my Fedora 32) does not like operations on stack:
>
> Starting program: /sdd/uros/git/gcc/gcc/testsuite/gcc.dg/atomic/a.out
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000000040110a in main ()
> (gdb) disass
> Dump of assembler code for function main:
> 0x0000000000401106 <+0>: push %rbp
> 0x0000000000401107 <+1>: mov %rsp,%rbp
> => 0x000000000040110a <+4>: lock orq $0x0,(%esp)
The culprit is the %esp here, that adds the 0x67 prefix to the insn and
will only work if %rsp is below 4GB.
> 0x0000000000401111 <+11>: mov $0x0,%eax
> 0x0000000000401116 <+16>: pop %rbp
> 0x0000000000401117 <+17>: retq
> End of assembler dump.
>
> I didn't investigate further, but 32bit executable works OK.