[llvm-bugs] [Bug 47148] New: Multiple inconsistent FDEs covering the same code addresses

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 12 15:46:18 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47148

            Bug ID: 47148
           Summary: Multiple inconsistent FDEs covering the same code
                    addresses
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: wittman at chromium.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

clang is emitting multiple FDEs that overlap the same code addresses and these
FDEs contain conflicting unwind information.

This was observed in Chromium's clang built from
1bd7046e4ce0102adef6096a12a289d7f94b8c73.

In the repro case below only one function is in the output, but the compiler
emits four FDEs of unwind instructions. All four overlap in the address range
0x0..0x10. The fourth FDEs has conflicting instructions for address 0x4
compared to the other three. The third FDE has conflicting instructions for
address 0x8 compared to the first and second, and the fourth.

test.cc:
template <class Tp>
struct compressed_pair {
  constexpr compressed_pair() : value() {}
  Tp value;
};

struct basic_string
{
  enum { n_words = 10 };

  struct raw {
    int words[n_words];
  };

  compressed_pair<raw> r;

  basic_string();

  void zero() {
    for (unsigned i = 0; i < n_words; ++i)
      r.value.words[i] = 0;
  }
};
inline basic_string::basic_string() { zero(); }

void foo() {
  basic_string s;
}

$ clang++ -target arm-linux-androideabi16 -g -funwind-tables
-fomit-frame-pointer -c test.cc -o test.o

$ objdump -j .text -dC test.o

test.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <foo()>:
   0:   e92d4800        push    {fp, lr}
   4:   e24dd028        sub     sp, sp, #40     ; 0x28
   8:   e1a0000d        mov     r0, sp
   c:   ebfffffe        bl      0 <foo()>
  10:   e28dd028        add     sp, sp, #40     ; 0x28
  14:   e8bd4800        pop     {fp, lr}
  18:   e12fff1e        bx      lr

$ llvm-dwarfdump --debug-frame test.o

test.o: file format ELF32-arm-little

.debug_frame contents:

00000000 00000010 ffffffff CIE
  Version:               4
  Augmentation:          ""
  Address size:          4
  Segment desc size:     0
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 14

  DW_CFA_def_cfa: reg13 +0
  DW_CFA_nop:
  DW_CFA_nop:

00000014 00000018 00000000 FDE cie=00000000 pc=00000000...0000001c
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +8
  DW_CFA_offset: reg14 -4
  DW_CFA_offset: reg11 -8
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +48
  DW_CFA_nop:
  DW_CFA_nop:

00000030 00000018 00000000 FDE cie=00000000 pc=00000000...00000030
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +8
  DW_CFA_offset: reg14 -4
  DW_CFA_offset: reg11 -8
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +16
  DW_CFA_nop:
  DW_CFA_nop:

0000004c 00000018 00000000 FDE cie=00000000 pc=00000000...0000002c
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +8
  DW_CFA_offset: reg14 -4
  DW_CFA_offset: reg11 -8
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +16
  DW_CFA_nop:
  DW_CFA_nop:

00000068 00000010 00000000 FDE cie=00000000 pc=00000000...00000058
  DW_CFA_advance_loc: 4
  DW_CFA_def_cfa_offset: +12
  DW_CFA_nop:

.eh_frame contents:

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200812/aaa3c8e7/attachment.html>


More information about the llvm-bugs mailing list