<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Incorrect DWARF at -O3 for function inside struct"
   href="https://bugs.llvm.org/show_bug.cgi?id=48667">48667</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect DWARF  at -O3 for function inside struct
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cmtice@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24353" name="attach_24353" title="test file to reproduce issue">attachment 24353</a> <a href="attachment.cgi?id=24353&action=edit" title="test file to reproduce issue">[details]</a></span>
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; }
$</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>