[llvm-bugs] [Bug 52159] New: Debug info for imported declarations sometimes reference empty DIEs

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 12 17:42:56 PDT 2021


            Bug ID: 52159
           Summary: Debug info for imported declarations sometimes
                    reference empty DIEs
           Product: libraries
           Version: 12.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: ellis.sparky.hoag at gmail.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

When an imported declaration references a function that has been inlined and
removed, its DIE will reference an empty subprogram DIE. 

In clang, it creates a new empty DIE rather than using the existing abstract
origin DIE.
$ cat main.cpp
namespace ns {
inline __attribute__((always_inline))
void foo() { int a = 4; }

void goo() {
  using ns::foo;
$ clang -g main.cpp -c -o - | llvm-dwarfdump -
0x0000000b: DW_TAG_compile_unit

0x0000002a:   DW_TAG_namespace
                DW_AT_name      ("ns")

0x0000002f:     DW_TAG_subprogram
                  DW_AT_linkage_name    ("_ZN2ns3fooEv")
                  DW_AT_name    ("foo")
                  DW_AT_decl_line       (3)
                  DW_AT_external        (true)
                  DW_AT_inline  (DW_INL_inlined)

0x0000003b:       DW_TAG_variable
                    DW_AT_name  ("a")
                    DW_AT_decl_line     (3)
                    DW_AT_type  (0x00000049 "int")

0x00000046:       NULL

0x00000047:     DW_TAG_subprogram

0x00000048:     NULL

0x00000050:   DW_TAG_subprogram
                DW_AT_low_pc    (0x0000000000000000)
                DW_AT_high_pc   (0x000000000000000d)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_linkage_name      ("_Z3goov")
                DW_AT_name      ("goo")
                DW_AT_decl_line (6)
                DW_AT_external  (true)

0x00000069:     DW_TAG_imported_declaration
                  DW_AT_decl_line       (7)
                  DW_AT_import  (0x00000047)

0x00000070:     DW_TAG_inlined_subroutine
                  DW_AT_abstract_origin (0x0000002f "_ZN2ns3fooEv")
                  DW_AT_low_pc  (0x0000000000000004)
                  DW_AT_high_pc (0x000000000000000b)
                  DW_AT_call_line       (8)
                  DW_AT_call_column     (0x03)

0x00000084:       DW_TAG_variable
                    DW_AT_location      (DW_OP_fbreg -4)
                    DW_AT_abstract_origin       (0x0000003b "a")

0x0000008c:       NULL

0x0000008d:     NULL

0x0000008e:   NULL

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/20211013/375066f0/attachment-0001.html>

More information about the llvm-bugs mailing list