<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 --- - IRMover duplicates global variable !dbg attachments"
   href="https://llvm.org/bugs/show_bug.cgi?id=31012">31012</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IRMover duplicates global variable !dbg attachments
          </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>Linker
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>aprantl@apple.com
          </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=17585" name="attach_17585" title="test case with a global variable">attachment 17585</a> <a href="attachment.cgi?id=17585&action=edit" title="test case with a global variable">[details]</a></span>
test case with a global variable

To reproduce, copy the attached testcase to test/Linker or just run it through
llvm-link with any other module as a second input.

The global object g

<span class="quote">> @g = common global i32 0, align 4, !dbg !0</span >

will first be materialized with a !dbg attachement. Later, IRMover will invoke
linkGlobalValueBody() which calls GlobalObject::copyMetadata() a second time,
thus duplicating the !dbg attachment and creating an object g

<span class="quote">> @g = common global i32 0, align 4, !dbg !0, !dbg 0</span >

with a duplicate !dbg attachment.</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>