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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-06-11
             Status|UNCONFIRMED                 |WAITING

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Zdenek Sojka from comment #0)
> Created attachment 50981 [details]
> auto-reduced testcase (from OpenTTD sources)
> 
> Compiler output:
> $ x86_64-pc-linux-gnu-g++ -O2 -mtune=opteron -mstackrealign
> --param=hot-bb-frequency-fraction=1 testcase.C -S
> 
> The offending code is:
> .L8:
>       pushq   %rbp
>       .cfi_def_cfa_offset 16
>       .cfi_offset 6, -16
>       movq    %rsp, %rbp
>       .cfi_def_cfa_register 6
>       movq    %r12, -8(%rbp)
>       pushq   %rax
> 
> the "push" overwrites r12 stored just one instruction above; when returning:
>       movq    -8(%rbp), %r12
>       xorl    %eax, %eax
>       leave
>       .cfi_def_cfa 7, 8
>       ret
> 
> the wrong data is restored to r12
> 
> I wasn't able yet to generate an executable testcase, but I can try to if
> needed. (it shouldn't be that hard, just r12 needs to be used by the caller
> during the call)

Please create a run-time testcase.

Reply via email to