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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #41834|0                           |1
        is obsolete|                            |

--- Comment #15 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 41839
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41839&action=edit
A patch

-g -O2 -flto generates:

Dump of assembler code for function fn:
   0x0000000000400550 <+0>:     push   %rdi
   0x0000000000400551 <+1>:     sub    $0x8,%rsp
   0x0000000000400555 <+5>:     cmpq   $0x12345670,0x10(%rsp)
   0x000000000040055e <+14>:    jne    0x400430 <fn>
=> 0x0000000000400564 <+20>:    cmpq   $0x12345671,0x18(%rsp)

with debug info:

00000084 0000000000000018 00000058 FDE cie=00000030
pc=0000000000400550..00000000004005b7
  DW_CFA_advance_loc: 1 to 0000000000400551
  DW_CFA_def_cfa_offset: 16
  DW_CFA_offset: r5 (rdi) at cfa-16
  DW_CFA_advance_loc: 4 to 0000000000400555
  DW_CFA_def_cfa_offset: 24
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

-g -O2 generates:

   0x0000000000400550 <+0>:     push   %rdi
   0x0000000000400551 <+1>:     sub    $0x8,%rsp
   0x0000000000400555 <+5>:     cmpq   $0x12345670,0x10(%rsp)
   0x000000000040055e <+14>:    jne    0x400430 <fn>
   0x0000000000400564 <+20>:    cmpq   $0x12345671,0x18(%rsp)

with debug info:

00000070 0000000000000018 00000044 FDE cie=00000030
pc=0000000000400550..00000000004005b7
  DW_CFA_advance_loc: 1 to 0000000000400551
  DW_CFA_def_cfa_offset: 24 
  DW_CFA_offset: r5 (rdi) at cfa-24
  DW_CFA_advance_loc: 4 to 0000000000400555
  DW_CFA_def_cfa_offset: 32 
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

Somehow -flto -O2 generates the incorrect debug info.

Reply via email to