<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 - Assertion failure during report of duplicate symbol error"
   href="https://bugs.llvm.org/show_bug.cgi?id=46348">46348</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure during report of duplicate symbol error
          </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>Windows NT
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jh7370.2008@my.bristol.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23620" name="attach_23620" title="Reproducer">attachment 23620</a> <a href="attachment.cgi?id=23620&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Whilst experimenting with a script to generate some objects with debug data and
then linking them, I ran into an assertion produced by LLD whilst it was
reporting a duplicate symbol error. The full output is:

PS C:\Work\TOOLCHAIN-5886> C:\llvm\build\Debug\bin\ld.lld.exe test.o test2.o -o
test.elf --reproduce=repro.tar
Assertion failed: Val && "isa<> used on a null pointer", file
C:\llvm\llvm-project\llvm\include\llvm/Support/Casting.h, line 104
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: C:\llvm\build\Debug\bin\ld.lld.exe test.o test2.o -o
test.elf --reproduce=repro.tar
 #0 0x00007ff639c3839c HandleAbort
c:\llvm\llvm-project\llvm\lib\support\windows\signals.inc:408:0
 #1 0x00007ff9aac9c3e1 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6c3e1)
 #2 0x00007ff9aac9e039 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6e039)
 #3 0x00007ff9aaca3c65 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x73c65)
 #4 0x00007ff9aaca37d7 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x737d7)
 #5 0x00007ff9aaca1841 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x71841)
 #6 0x00007ff9aaca41cf (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x741cf)
 #7 0x00007ff639f8aecc llvm::isa_impl_cl<class lld::elf::Defined, class
lld::elf::Symbol const *>::doit(class lld::elf::Symbol const *)
c:\llvm\llvm-project\llvm\include\llvm\support\casting.h:104:0
 #8 0x00007ff639f8b5fb llvm::isa_impl_wrap<class lld::elf::Defined, class
lld::elf::Symbol const *, class lld::elf::Symbol const *>::doit(class
lld::elf::Symbol const *const &)
c:\llvm\llvm-project\llvm\include\llvm\support\casting.h:132:0
 #9 0x00007ff639f8b647 llvm::isa_impl_wrap<class lld::elf::Defined, class
lld::elf::Symbol *const, class lld::elf::Symbol const *>::doit(class
lld::elf::Symbol *const &)
c:\llvm\llvm-project\llvm\include\llvm\support\casting.h:124:0
#10 0x00007ff639f5aff8 llvm::isa<class lld::elf::Defined, class
lld::elf::Symbol *>(class lld::elf::Symbol *const &)
c:\llvm\llvm-project\llvm\include\llvm\support\casting.h:143:0
#11 0x00007ff639f53168 llvm::dyn_cast<class lld::elf::Defined, class
lld::elf::Symbol>(class lld::elf::Symbol *)
c:\llvm\llvm-project\llvm\include\llvm\support\casting.h:339:0
#12 0x00007ff63a042d6f lld::elf::InputSectionBase::getObjMsg(unsigned __int64)
c:\llvm\llvm-project\lld\elf\inputsection.cpp:350:0
#13 0x00007ff63a074d6a reportDuplicate
c:\llvm\llvm-project\lld\elf\symbols.cpp:643:0
#14 0x00007ff63a073861 lld::elf::Symbol::resolveDefined(class lld::elf::Defined
const &) c:\llvm\llvm-project\lld\elf\symbols.cpp:691:0
#15 0x00007ff63a0731a4 lld::elf::Symbol::resolve(class lld::elf::Symbol const
&) c:\llvm\llvm-project\lld\elf\symbols.cpp:425:0
#16 0x00007ff63a036ab8 lld::elf::ObjFile<struct llvm::object::ELFType<1,
1>>::initializeSymbols(void) c:\llvm\llvm-project\lld\elf\inputfiles.cpp:1142:0
#17 0x00007ff63a03b5c4 lld::elf::ObjFile<struct llvm::object::ELFType<1,
1>>::parse(bool) c:\llvm\llvm-project\lld\elf\inputfiles.cpp:402:0
#18 0x00007ff639fb2625 doParseFile<llvm::object::ELFType<1,1> >
c:\llvm\llvm-project\lld\elf\inputfiles.cpp:209:0
#19 0x00007ff639fafeff lld::elf::parseFile(class lld::elf::InputFile *)
c:\llvm\llvm-project\lld\elf\inputfiles.cpp:222:0
#20 0x00007ff639f5b90f lld::elf::LinkerDriver::link<struct
llvm::object::ELFType<1, 1>>(class llvm::opt::InputArgList &)
c:\llvm\llvm-project\lld\elf\driver.cpp:1870:0
#21 0x00007ff639f299b5 lld::elf::LinkerDriver::main(class llvm::ArrayRef<char
const *>) c:\llvm\llvm-project\lld\elf\driver.cpp:526:0
#22 0x00007ff639f2b55c lld::elf::link(class llvm::ArrayRef<char const *>, bool,
class llvm::raw_ostream &, class llvm::raw_ostream &)
c:\llvm\llvm-project\lld\elf\driver.cpp:119:0
#23 0x00007ff639b50942 main c:\llvm\llvm-project\lld\tools\lld\lld.cpp:149:0
#24 0x00007ff6404485c4 invoke_main
d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
#25 0x00007ff6404484ae __scrt_common_main_seh
d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#26 0x00007ff64044836e __scrt_common_main
d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
#27 0x00007ff640448659 mainCRTStartup
d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#28 0x00007ff9f4307bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
#29 0x00007ff9f488ce51 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ce51)

I'll attach the repro.tar file too.</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>