| Issue |
75933
|
| Summary |
__underlying_type compiler crash
|
| Labels |
|
| Assignees |
|
| Reporter |
ordinary-github-user
|
https://godbolt.org/z/fKf4K8zcr
`-std=c++26`
```c++
template<auto Value>struct Constant{};
template<class T>
void asdf()noexcept
{
[]<T flag>(Constant<flag>)
{
static_cast<__underlying_type(decltype(flag))>(flag);
}(Constant<T::a>{});
}
enum class E{a};
int main()
{
asdf<E>();
}
```
```
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-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++26 <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:6:2: Generating code for declaration 'asdf()::(anonymous class)::operator()'
#0 0x0000000003527418 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3527418)
#1 0x0000000003525564 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3525564)
#2 0x0000000003472a38 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007fe524642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00000000037cafb2 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x37cafb2)
#5 0x00000000037cb268 clang::CodeGen::CGDebugInfo::EmitExplicitCastType(clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x37cb268)
#6 0x0000000003c4c5fc (anonymous namespace)::ScalarExprEmitter::VisitExplicitCastExpr(clang::ExplicitCastExpr*) CGExprScalar.cpp:0:0
#7 0x0000000003c41379 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#8 0x0000000003c43633 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c43633)
#9 0x0000000003be78be clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3be78be)
#10 0x0000000003c019cb clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c019cb)
#11 0x000000000382c22e clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x382c22e)
#12 0x0000000003832149 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3832149)
#13 0x000000000389b419 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x389b419)
#14 0x00000000038f62db clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38f62db)
#15 0x00000000038f2043 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38f2043)
#16 0x00000000038fbcf2 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38fbcf2)
#17 0x00000000038fbd0a clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38fbd0a)
#18 0x00000000038fe473 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38fe473)
#19 0x0000000003d5b50a (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#20 0x0000000003d5a224 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d5a224)
#21 0x0000000005b978b9 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5b978b9)
#22 0x0000000003d59875 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d59875)
#23 0x0000000003fde3c1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fde3c1)
#24 0x0000000003f5b93b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f5b93b)
#25 0x00000000040bd4d3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x40bd4d3)
#26 0x0000000000c10dd6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc10dd6)
#27 0x0000000000c0982d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x0000000003da0629 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
#29 0x0000000003472e63 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3472e63)
#30 0x0000000003da0849 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
#31 0x0000000003d68ec7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d68ec7)
#32 0x0000000003d6987d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d6987d)
#33 0x0000000003d735cc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d735cc)
#34 0x0000000000c0e1b1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc0e1b1)
#35 0x0000000000b07f11 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb07f11)
#36 0x00007fe524629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#37 0x00007fe524629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#38 0x0000000000c0902e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc0902e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs