-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion fails in bitcode writer with LLVM 12 RC5+ #49263
Comments
The reason is that |
Is there a fix for this? |
From separate email from Martin Kinkelin
Tom, |
corrected mangled URL: llvm-project/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp Lines 1003 to 1006 in fed4134
|
It's too late, 12.0.1 has already been released. |
Extended Description
While testing LLVM 12 RC5+ (fa0971b) 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::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_deletellvm::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
The text was updated successfully, but these errors were encountered: