<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - MSVC: attachment points at wrong subprogram for function"
   href="https://llvm.org/bugs/show_bug.cgi?id=25564">25564</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MSVC: attachment points at wrong subprogram for function
          </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>normal
          </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>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15309" name="attach_15309" title="Failing IR">attachment 15309</a> <a href="attachment.cgi?id=15309&action=edit" title="Failing IR">[details]</a></span>
Failing IR

When compiling the attached IR with llc, I get:


!dbg attachment points at wrong subprogram for function
!1 = distinct !DISubprogram(name: "main", linkageName:
"_ZN19backtrace_debuginfo4mainE", scope: !3, file: !2, line: 1, type: !4,
isLocal: true, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped,
isOptimized: true, templateParams: !5, variables: !5)
void ()* @foo
  call void @bar(), !dbg !19
!19 = !DILocation(line: 1219, scope: !20, inlinedAt: !21)
!25 = distinct !DILexicalBlock(scope: !26, file: !2, line: 1, column: 10)
!26 = distinct !DISubprogram(name: "main", linkageName:
"_ZN19backtrace_debuginfo4mainE", scope: !3, file: !2, line: 1, type: !4,
isLocal: true, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped,
isOptimized: true, templateParams: !5, variables: !5)
LLVM ERROR: Broken function found, compilation aborted!



But when the target is changed to x86_64-unknown-linux-gnu the file compiles
successfully. I'm not 100% sure that we correctly emit debuginfo in the first
place (not my area of expertise), and this may also be related to r252219 but I
figured it was odd at least that it failed to compile with an MSVC target yet
successfully compiled for a Linux one!</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>