<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 `(ID || !Mod) && "asked for module ID for non-local, non-imported module"' failed"
href="https://bugs.llvm.org/show_bug.cgi?id=50592">50592</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion `(ID || !Mod) && "asked for module ID for non-local, non-imported module"' failed
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>davidfromonline@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Compiling the following translation unit
```
#include <type_traits>
```
with `clang++ -std=c++20 -stdlib=libc++ -fmodules`
causes clang to crash with
```
clang++: /root/llvm-project/clang/lib/Serialization/ASTWriter.cpp:2502:
unsigned int clang::ASTWriter::getSubmoduleID(clang::Module*): Assertion `(ID
|| !Mod) && "asked for module ID for non-local, non-imported module"' failed.
clang++: /root/llvm-project/llvm/include/llvm/Bitstream/BitstreamWriter.h:124:
llvm::BitstreamWriter::~BitstreamWriter(): Assertion `BlockScope.empty() &&
CurAbbrevs.empty() && "Block imbalance"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments:
/opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s
-mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics
-fno-crash-diagnostics -std=c++20 -stdlib=libc++ -fmodules <source>
1. <source>:1:2: current parser token 'include'
#0 0x000055d922ec2a6f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000055d922ec0890 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x378b890)
#2 0x000055d922e107a8 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
#3 0x00007f2869ffe3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x00007f2869ace18b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618b)
#5 0x00007f2869aad859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
#6 0x00007f2869aad729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729)
#7 0x00007f2869abef36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#8 0x000055d9239babe0 clang::PCHGenerator::~PCHGenerator()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4285be0)
#9 0x000055d9239bac09 clang::PCHGenerator::~PCHGenerator()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4285c09)
#10 0x000055d9237fc7f2 clang::MultiplexConsumer::~MultiplexConsumer()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40c77f2)
#11 0x000055d92376a9ea clang::CompilerInstance::~CompilerInstance()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40359ea)
#12 0x000055d92376fb02 compileModuleImpl(clang::CompilerInstance&,
clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile,
llvm::StringRef, llvm::StringRef, llvm::function_ref<void
(clang::CompilerInstance&)>, llvm::function_ref<void
(clang::CompilerInstance&)>) CompilerInstance.cpp:0:0
#13 0x000055d923772fac
clang::CompilerInstance::findOrCompileModuleAndReadAST(llvm::StringRef,
clang::SourceLocation, clang::SourceLocation, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x403dfac)
#14 0x000055d923773c1e
clang::CompilerInstance::loadModule(clang::SourceLocation,
llvm::ArrayRef<std::pair<clang::IdentifierInfo*, clang::SourceLocation> >,
clang::Module::NameVisibilityKind, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x403ec1e)
#15 0x000055d925e680aa
clang::Preprocessor::HandleHeaderIncludeOrImport(clang::SourceLocation,
clang::Token&, clang::Token&, clang::SourceLocation, clang::DirectoryLookup
const*, clang::FileEntry const*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67330aa)
#16 0x000055d925e69216
clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation,
clang::Token&, clang::DirectoryLookup const*, clang::FileEntry const*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6734216)
#17 0x000055d925e6c98b clang::Preprocessor::HandleDirective(clang::Token&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x673798b)
#18 0x000055d925e33801 clang::Lexer::LexTokenInternal(clang::Token&, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66fe801)
#19 0x000055d925e35856 clang::Lexer::Lex(clang::Token&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6700856)
#20 0x000055d925e9feb7 clang::Preprocessor::Lex(clang::Token&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x676aeb7)
#21 0x000055d924d2f7c2 clang::Parser::ConsumeToken()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x55fa7c2)
#22 0x000055d924d2e35f clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x55f935f)
#23 0x000055d923e6bc88 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4736c88)
#24 0x000055d9237cd101 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4098101)
#25 0x000055d9237699ca
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40349ca)
#26 0x000055d92389a5fa
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41655fa)
#27 0x000055d920ab799c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x138299c)
#28 0x000055d920ab2d39 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#29 0x000055d92361cca5 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#30 0x000055d922e10d93
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36dbd93)
#31 0x000055d92361ee54
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ee9e54)
#32 0x000055d9235f565a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ec065a)
#33 0x000055d9235f62ff
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ec12ff)
#34 0x000055d9235ffbaa
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ecabaa)
#35 0x000055d9209e1888 main
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x12ac888)
#36 0x00007f2869aaf0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#37 0x000055d920ab28aa _start
(/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x137d8aa)
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
Compiler returned: 134
```
This failure was introduced by
<a href="https://github.com/llvm/llvm-project/commit/f1417eb9b1f51b689c78dd8cb0114c1749dd2845">https://github.com/llvm/llvm-project/commit/f1417eb9b1f51b689c78dd8cb0114c1749dd2845</a>
See it live: <a href="https://godbolt.org/z/sja1fqvxY">https://godbolt.org/z/sja1fqvxY</a></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>