<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 - lld crash on guid collision when using thinlto"
   href="https://bugs.llvm.org/show_bug.cgi?id=43250">43250</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld crash on guid collision when using thinlto
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>the_jk@opera.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22479" name="attach_22479" title="Full stacktrace">attachment 22479</a> <a href="attachment.cgi?id=22479&action=edit" title="Full stacktrace">[details]</a></span>
Full stacktrace

Happened upon a crash in lld when linking Chromium (see
<a href="https://crbug.com/1000691">https://crbug.com/1000691</a>).

Two global symbols (one function and one variable) from different modules end
up with the same GUID.

When linking using thinlto this leads to a crash because code in
FunctionImportUtils.cpp treats any GlobalValue with a GlobalVarSummary attached
as a GlobalVariable but as both the symbols have the same GUID the global
function also has the GlobalVarSummary attached.

Assert:
ld.lld: chromium/src/third_party/llvm/llvm/include/llvm/Support/Casting.h:264:
typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X =
llvm::GlobalVariable, Y = llvm::GlobalValue]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.

Top of stacktrace (full stacktrace attached):
#4  0x000056267cb57788 in llvm::cast<llvm::GlobalVariable, llvm::GlobalValue>
(Val=<optimized out>)
    at chromium/src/third_party/llvm/llvm/include/llvm/Support/Casting.h:264
#5  llvm::FunctionImportGlobalProcessing::processGlobalForThinLTO
(this=0x7f7ec9d06720, GV=...)
    at
chromium/src/third_party/llvm/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:252
#6  0x000056267cb5792c in
llvm::FunctionImportGlobalProcessing::processGlobalsForThinLTO
(this=0x7f7ec9d06720)
    at
chromium/src/third_party/llvm/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:296
#7  0x000056267cb57bfd in llvm::FunctionImportGlobalProcessing::run
(this=0x7f7ec9d06720)
    at
chromium/src/third_party/llvm/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:312
#8  llvm::renameModuleForThinLTO (M=..., Index=..., GlobalsToImport=<optimized
out>)
    at
chromium/src/third_party/llvm/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:319</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>