<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 - -gmodules -gpubnames together cause a crash"
   href="https://bugs.llvm.org/show_bug.cgi?id=43661">43661</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-gmodules -gpubnames together cause a crash
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>l.lunak@centrum.cz
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using together -gmodules and -gpubnames may lead to a nullptr crash (or
infinite loop if Clang is built with -O2).

Steps to reproduce:

See the attached archive, run a.sh . Removing either -gmodule or -gpubnames
avoids the problem.

Relevant part of backtrace:

 #3 0x00007ff64b14b300 __restore_rt (/lib64/libpthread.so.0+0x12300)
 #4 0x00007ff6495f825c llvm::DwarfCompileUnit::getUniqueID() const
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:110:41
 #5 0x00007ff6495f81cd llvm::emitDWARF5AccelTable(llvm::AsmPrinter*,
llvm::AccelTable<llvm::DWARF5AccelTableData>&, llvm::DwarfDebug const&,
llvm::ArrayRef<std::unique_ptr<llvm::DwarfCompileUnit,
std::default_delete<llvm::DwarfCompileUnit> >
<span class="quote">>)::$_3::operator()(llvm::DWARF5AccelTableData const&) const</span >
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp:579:24
 #6 0x00007ff6495f8170 unsigned int llvm::function_ref<unsigned int
(llvm::DWARF5AccelTableData
const&)>::callback_fn<llvm::emitDWARF5AccelTable(llvm::AsmPrinter*,
llvm::AccelTable<llvm::DWARF5AccelTableData>&, llvm::DwarfDebug const&,
llvm::ArrayRef<std::unique_ptr<llvm::DwarfCompileUnit,
std::default_delete<llvm::DwarfCompileUnit> > >)::$_3>(long,
llvm::DWARF5AccelTableData const&)
/home/seli/build/src/llvm/llvm/include/llvm/ADT/STLExtras.h:113:5
 #7 0x00007ff6495fddac llvm::function_ref<unsigned int
(llvm::DWARF5AccelTableData const&)>::operator()(llvm::DWARF5AccelTableData
const&) const /home/seli/build/src/llvm/llvm/include/llvm/ADT/STLExtras.h:130:5
 #8 0x00007ff6495fdbd0 (anonymous
namespace)::Dwarf5AccelTableWriter<llvm::DWARF5AccelTableData>::emitEntry(llvm::DWARF5AccelTableData
const&) const
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp:486:21
 #9 0x00007ff6495fce41 (anonymous
namespace)::Dwarf5AccelTableWriter<llvm::DWARF5AccelTableData>::emitData()
const
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp:506:30
#10 0x00007ff6495ead29 (anonymous
namespace)::Dwarf5AccelTableWriter<llvm::DWARF5AccelTableData>::emit() const
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp:539:3
#11 0x00007ff6495ea462 llvm::emitDWARF5AccelTable(llvm::AsmPrinter*,
llvm::AccelTable<llvm::DWARF5AccelTableData>&, llvm::DwarfDebug const&,
llvm::ArrayRef<std::unique_ptr<llvm::DwarfCompileUnit,
std::default_delete<llvm::DwarfCompileUnit> > >)
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp:575:3
#12 0x00007ff649631905 llvm::DwarfDebug::endModule()
/home/seli/build/src/llvm/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1256:3

In the lambda in llvm::emitDWARF5AccelTable() the value returned by
"DD.lookupCU(CUDie)" is nullptr. Presumably some of the debug info is not
present because of -gmodules and the PCH used, but this code doesn't account
for such a case?</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>