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

AJ D <aatsnps at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---
            Version|6.2.0                       |9.2.0

--- Comment #4 from AJ D <aatsnps at gmail dot com> ---
I can reproduce this issue with gcc 9.2, but this time, on a different routine
(not on the previously reported routine).


GCC Version
============
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


GCC Configuration
=================
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/depot/qsc/QSCS/GCC/libexec/gcc/x86_64-centos-linux/9.2.0/lto-wrapper
Target: x86_64-centos-linux
Configured with: ../src/gcc-9.2.0/configure --prefix=/depot/gcc-9.2.0
--enable-bootstrap --enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,fortran --disable-libgcj --with-cpu=generic
--build=x86_64-centos-linux
Thread model: posix
gcc version 9.2.0 (GCC) 


Assembly Code
=============

0000000000002c10 <raceGetDistSelectInterval>:
    2c10:       4c 8d 54 24 08          lea    0x8(%rsp),%r10
    2c15:       48 83 e4 f0             and    $0xfffffffffffffff0,%rsp
    2c19:       41 ff 72 f8             pushq  -0x8(%r10)
    2c1d:       55                      push   %rbp
=>  2c1e:       48 89 e5                mov    %rsp,%rbp
    2c21:       41 57                   push   %r15
    2c23:       41 56                   push   %r14
    2c25:       41 55                   push   %r13
    2c27:       41 54                   push   %r12
    2c29:       41 52                   push   %r10

Interrupt happened while on this instruction.

=>  2c1e:       48 89 e5                mov    %rsp,%rbp

Here (before executing this instruction), rbp is pointing to parent frame.

So, the following DWARF doesn't look quite right.

000006b0 0000000000000044 000006b4 FDE cie=00000000
pc=0000000000002c10..0000000000003607
  DW_CFA_advance_loc: 5 to 0000000000002c15
  DW_CFA_def_cfa: r10 (r10) ofs 0
  DW_CFA_advance_loc: 9 to 0000000000002c1e
  DW_CFA_expression: r6 (rbp) (DW_OP_breg6 (rbp): 0)
  DW_CFA_advance_loc: 13 to 0000000000002c2b
  DW_CFA_def_cfa_expression (DW_OP_breg6 (rbp): -40; DW_OP_deref)
  DW_CFA_expression: r15 (r15) (DW_OP_breg6 (rbp): -8)
  DW_CFA_expression: r14 (r14) (DW_OP_breg6 (rbp): -16)
  DW_CFA_expression: r13 (r13) (DW_OP_breg6 (rbp): -24)
  DW_CFA_expression: r12 (r12) (DW_OP_breg6 (rbp): -32)


>>   DW_CFA_advance_loc: 9 to 0000000000002c1e
>>   DW_CFA_expression: r6 (rbp) (DW_OP_breg6 (rbp): 0)

Notice at address 0000000000002c1e, we are relying on rbp which is pointing to
the caller procedure's rbp, not the current procedure's rbp.


000006b0 0000000000000044 000006b4 FDE cie=00000000
pc=0000000000002c10..0000000000003607
   LOC           CFA      rbx   rbp   r12   r13   r14   r15   ra      
0000000000002c10 rsp+8    u     u     u     u     u     u     c-8   
0000000000002c15 r10+0    u     u     u     u     u     u     c-8   
0000000000002c1e r10+0    u     exp   u     u     u     u     c-8   
0000000000002c2b exp      u     exp   exp   exp   exp   exp   c-8   
0000000000002c2c exp      exp   exp   exp   exp   exp   exp   c-8   
0000000000002e16 r10+0    exp   exp   exp   exp   exp   exp   c-8   
0000000000002e23 rsp+8    exp   exp   exp   exp   exp   exp   c-8   
0000000000002e24 exp      exp   exp   exp   exp   exp   exp   c-8   


Actual GDB disassemble at the crash point:


Dump of assembler code for function raceGetDistSelectInterval:
   0x00002aaaafd63bd0 <+0>: lea    0x8(%rsp),%r10
   0x00002aaaafd63bd5 <+5>: and    $0xfffffffffffffff0,%rsp
   0x00002aaaafd63bd9 <+9>: pushq  -0x8(%r10)
   0x00002aaaafd63bdd <+13>:    push   %rbp
=> 0x00002aaaafd63bde <+14>:    mov    %rsp,%rbp
   0x00002aaaafd63be1 <+17>:    push   %r15
   0x00002aaaafd63be3 <+19>:    push   %r14


I will add the .i file in few days (have to take care of IP issues as per my
company guidelines).

Reply via email to