[Bug debug/42403] New: Incorrect CFI: doesn't readjust CFA after pop

tschwinge at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Dec 17 13:55:00 GMT 2009


$ install/bin/arm-none-linux-gnueabi-gcc --version
    arm-none-linux-gnueabi-gcc (GCC) 4.5.0 20091214 (experimental)
    [...]

GCC fails to re-adjust the CFA after pop:

    $ cat d.c
    void foo(void)
    {
      register int r7 asm("r7");

      asm volatile ("" : : "r" (r7) : "memory");
    }
    $ install/bin/arm-none-linux-gnueabi-gcc -g -O -c -o d.o d.c
    $ install/bin/arm-none-linux-gnueabi-objdump -dr d.o

    d.o:     file format elf32-littlearm


    Disassembly of section .text:

    00000000 <foo>:
       0:   e52d7004        push    {r7}            ; (str r7, [sp, #-4]!)
       4:   e8bd0080        pop     {r7}
       8:   e12fff1e        bx      lr
    $ install/bin/arm-none-linux-gnueabi-readelf -wf d.o
    Contents of the .debug_frame section:

    00000000 0000000c ffffffff CIE
      Version:               1
      Augmentation:          ""
      Code alignment factor: 1
      Data alignment factor: -4
      Return address column: 14

      DW_CFA_def_cfa: r13 ofs 0

    00000010 00000014 00000000 FDE cie=00000000 pc=00000000..0000000c
      DW_CFA_advance_loc: 4 to 00000004
      DW_CFA_def_cfa_offset: 4
      DW_CFA_offset: r7 at cfa-4
      DW_CFA_nop
      DW_CFA_nop
      DW_CFA_nop

For correctness, GCC should emit .cfi_adjust_cfa_offset 0 and
.cfi_restore r7 at pos. 8.


-- 
           Summary: Incorrect CFI: doesn't readjust CFA after pop
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tschwinge at gcc dot gnu dot org
GCC target triplet: arm-none-linux-gnueabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42403



More information about the Gcc-bugs mailing list