[llvm-bugs] [Bug 49919] New: Assertion fails in bitcode writer with LLVM 12 RC5+

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 10 17:19:19 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49919

            Bug ID: 49919
           Summary: Assertion fails in bitcode writer with LLVM 12 RC5+
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kinke at gmx.net
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 24743
  --> https://bugs.llvm.org/attachment.cgi?id=24743&action=edit
.ll file

While testing LLVM 12 RC5+ (fa0971b87f) with LDC, I've hit a bitcode writer
assertion when targeting x86_64-windows-msvc. Creating textual LLVM assembly,
textual machine assembly and machine code works fine, just the bitcode fails -
pretty bad news for LTO. Switching the triple to x86_64-linux-gnu makes it work
as well.

I'm attaching the trivial textual LLVM assembly. The stack trace is:

Assertion failed: Val && "isa<> used on a null pointer", file
C:\LDC\llvm-project\llvm\include\llvm/Support/Casting.h, line 104
 #0 0x00007ff6d3c4bfd6 HandleAbort
C:\LDC\llvm-project\llvm\lib\Support\Windows\Signals.inc:408:0
 #1 0x00007ff6d4277cd4 raise
minkernel\crts\ucrt\src\appcrt\misc\signal.cpp:547:0
 #2 0x00007ff6d4266708 abort
minkernel\crts\ucrt\src\appcrt\startup\abort.cpp:71:0
 #3 0x00007ff6d426d518 common_assert_to_stderr<wchar_t>
minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:175:0
 #4 0x00007ff6d426d63a _wassert
minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:443:0
 #5 0x00007ff6d349bc1f llvm::ValueEnumerator::EnumerateType(class llvm::Type *)
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\ValueEnumerator.cpp:916:0
 #6 0x00007ff6d349fb90 llvm::ValueEnumerator::incorporateFunction(class
llvm::Function const &)
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\ValueEnumerator.cpp:1001:0
 #7 0x00007ff6d346f499 llvm::SmallVectorTemplateCommon<unsigned
int,void>::getFirstEl
C:\LDC\llvm-project\llvm\include\llvm\ADT\SmallVector.h:114:0
 #8 0x00007ff6d346f499 llvm::SmallVectorTemplateCommon<unsigned
int,void>::SmallVectorTemplateCommon
C:\LDC\llvm-project\llvm\include\llvm\ADT\SmallVector.h:121:0
 #9 0x00007ff6d346f499 llvm::SmallVectorTemplateBase<unsigned
int,1>::SmallVectorTemplateBase
C:\LDC\llvm-project\llvm\include\llvm\ADT\SmallVector.h:472:0
#10 0x00007ff6d346f499 llvm::SmallVectorImpl<unsigned int>::SmallVectorImpl
C:\LDC\llvm-project\llvm\include\llvm\ADT\SmallVector.h:573:0
#11 0x00007ff6d346f499 llvm::SmallVector<unsigned int,64>::SmallVector
C:\LDC\llvm-project\llvm\include\llvm\ADT\SmallVector.h:1171:0
#12 0x00007ff6d346f499 `anonymous
namespace'::ModuleBitcodeWriter::writeFunction
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\BitcodeWriter.cpp:3268:0
#13 0x00007ff6d3460376 llvm::operator!=
C:\LDC\llvm-project\llvm\include\llvm\ADT\ilist_iterator.h:148:0
#14 0x00007ff6d3460376 `anonymous namespace'::ModuleBitcodeWriter::write
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\BitcodeWriter.cpp:4396:0
#15 0x00007ff6d34601e7 `anonymous
namespace'::ModuleBitcodeWriterBase::~ModuleBitcodeWriterBase
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\BitcodeWriter.cpp:156:0
#16 0x00007ff6d34601e7 llvm::BitcodeWriter::writeModule(class llvm::Module
const &, bool, class llvm::ModuleSummaryIndex const *, bool, class
std::array<unsigned int, 5> *)
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\BitcodeWriter.cpp:4576:0
#17 0x00007ff6d3460bd7 llvm::WriteBitcodeToFile(class llvm::Module const &,
class llvm::raw_ostream &, bool, class llvm::ModuleSummaryIndex const *, bool,
class std::array<unsigned int, 5> *)
C:\LDC\llvm-project\llvm\lib\Bitcode\Writer\BitcodeWriter.cpp:4603:0
#18 0x00007ff6d125a498 writeModule(class llvm::Module *, char const *)
C:\LDC\ldc\driver\toobj.cpp:390:0
#19 0x00007ff6d11e55aa
std::unique_ptr<llvm::ToolOutputFile,std::default_delete<llvm::ToolOutputFile>
>::operator bool C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\memory:2672:0
#20 0x00007ff6d11e55aa ldc::CodeGenerator::writeAndFreeLLModule(char const *)
C:\LDC\ldc\driver\codegenerator.cpp:274:0
#21 0x00007ff6d11e611e Logger::enabled C:\LDC\ldc\gen\logger.h:106:0
#22 0x00007ff6d11e611e ldc::CodeGenerator::emit(class Module *)
C:\LDC\ldc\driver\codegenerator.cpp:282:0
#23 0x00007ff6d1176592 llvm::timeTraceProfilerEnabled
C:\LDC\LLVM-x64\include\llvm\Support\TimeProfiler.h:34:0
#24 0x00007ff6d1176592 TimeTraceScope::~TimeTraceScope
C:\LDC\ldc\driver\timetrace.h:56:0
#25 0x00007ff6d1176592 codegenModules(struct Array<class Module *> &)
C:\LDC\ldc\driver\main.cpp:1197:0
#26 0x00007ff6d103ebe9 mars_mainBody(struct Param &, struct Array<char const *>
&, struct Array<char const *> &) C:\LDC\ldc\dmd\mars.d:882:0
#27 0x00007ff6d1174975 cppmain(void) C:\LDC\ldc\driver\main.cpp:1141:0
#28 0x00007ff6d4052cc9 _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
(C:\LDC\ninja-ldc\bin\ldc2.exe+0x3102cc9)
#29 0x00007ff6d4052997 _d_run_main2 (C:\LDC\ninja-ldc\bin\ldc2.exe+0x3102997)
#30 0x00007ff6d4052c53 _d_wrun_main (C:\LDC\ninja-ldc\bin\ldc2.exe+0x3102c53)
#31 0x00007ff6d11740a3 wmain C:\LDC\ldc\driver\main.cpp:1007:0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210411/8e994df0/attachment-0001.html>


More information about the llvm-bugs mailing list