-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[C++26] Crash when indexing a pack with a pack of indices #86279
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
Labels
c++26
clang:codegen
IR generation bugs: mangling, exceptions, etc.
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Comments
@llvm/issue-subscribers-clang-codegen Author: Kai Müller (kaimfrai)
The following code crashes on the most recent clang trunk when compiling with `-std=c++2c`.
The intent is to transform a pack of types into two sub-packs using the new pack indexing feature in C++26.
https://godbolt.org/z/Px5c5971o
|
Confirmed with assertion trunk: https://godbolt.org/z/Y6cMj81v8 The backtrace looks like: #76674 Assertion: clang++: /root/llvm-project/clang/lib/AST/Decl.cpp:2561:
clang::APValue* clang::VarDecl::evaluateValueImpl(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&, bool) const:
Assertion `!Init->isValueDependent()' failed. Backtrace: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -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++2c <source>
1. <eof> parser at end of file
2. <source>:19:6: LLVM IR generation of declaration 'tl2'
3. <source>:19:6: Generating code for declaration 'tl2'
#0 0x000000000391d768 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x391d768)
#1 0x000000000391b44c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x391b44c)
#2 0x0000000003861d98 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f7714442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f77144969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007f7714442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007f77144287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007f771442871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007f7714439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000073357f3 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73357f3)
#10 0x000000000733587b clang::VarDecl::evaluateValue() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x733587b)
#11 0x0000000003c22b8b clang::CodeGen::ConstantEmitter::tryEmitPrivateForVarInit(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c22b8b)
#12 0x0000000003c22f21 clang::CodeGen::ConstantEmitter::tryEmitForInitializer(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c22f21)
#13 0x0000000003cf6a27 clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3cf6a27)
#14 0x0000000003d193e9 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d193e9)
#15 0x0000000003d1a470 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d1a470)
#16 0x0000000003d23a4b clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#17 0x00000000041bc306 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#18 0x00000000041acc28 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41acc28)
#19 0x00000000061b2564 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61b2564)
#20 0x00000000041b9e48 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41b9e48)
#21 0x00000000044390a9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44390a9)
#22 0x00000000043c26de clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43c26de)
#23 0x000000000451c0ce clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x451c0ce)
#24 0x0000000000c28ecc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc28ecc)
#25 0x0000000000c2215a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x00000000041fcdb9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#27 0x0000000003862244 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3862244)
#28 0x00000000041fd3af clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#29 0x00000000041c3745 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41c3745)
#30 0x00000000041c41ad clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41c41ad)
#31 0x00000000041cbf15 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41cbf15)
#32 0x0000000000c26365 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc26365)
#33 0x0000000000b1c824 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb1c824)
#34 0x00007f7714429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x00007f7714429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x0000000000c21c4e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc21c4e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134 |
CC @cor3ntin |
This was fixed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c++26
clang:codegen
IR generation bugs: mangling, exceptions, etc.
crash
Prefer [crash-on-valid] or [crash-on-invalid]
The following code crashes on the most recent clang trunk when compiling with
-std=c++2c
.The intent is to transform a pack of types into two sub-packs using the new pack indexing feature in C++26.
https://godbolt.org/z/Px5c5971o
The text was updated successfully, but these errors were encountered: