[llvm-bugs] [Bug 48667] New: Incorrect DWARF at -O3 for function inside struct

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 5 10:29:23 PST 2021


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

            Bug ID: 48667
           Summary: Incorrect DWARF  at -O3 for function inside struct
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: cmtice at google.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Created attachment 24353
  --> https://bugs.llvm.org/attachment.cgi?id=24353&action=edit
test file to reproduce issue

If I compile the small attached test case (reduced from real code) with -g -O3,
I get a DW_TAG_subprogram die with no attributes  in it:

$ clang++ -g -c -O3 ctor-test.cc
$ dwarfdump ctor-test.o

(Note the DIE at 0x46):

...

0x00000041:   DW_TAG_pointer_type
                DW_AT_type      (0x0000002a "foo")

0x00000046:   DW_TAG_subprogram

0x00000047:     DW_TAG_class_type
                  DW_AT_calling_convention      (DW_CC_pass_by_value)
                  DW_AT_byte_size       (0x01)
                  DW_AT_decl_file      
("/usr/local/google/home/cmtice/ctor-test.cc")
                  DW_AT_decl_line       (3)

0x0000004c:       DW_TAG_subprogram
                    DW_AT_name  ("operator()")
                    DW_AT_decl_file    
("/usr/local/google/home/cmtice/ctor-test.cc")
                    DW_AT_decl_line     (3)
                    DW_AT_type  (0x00000060 "auto")
                    DW_AT_declaration   (true)
                    DW_AT_external      (true)
                    DW_AT_accessibility (DW_ACCESS_public)
...

I'm attaching the test file and the dwarfdump I got.

$ cat ctor-test.cc
void f1();

struct foo { foo() { []{ f1(); }(); } };

int main() { foo f; }
$

-- 
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/20210105/df45c10a/attachment.html>


More information about the llvm-bugs mailing list