| Issue |
242122
|
| Summary |
[clang] Assertion `ControllingExprOrType && "Must have either a controlling _expression_ or a controlling type"' failed.
|
| Labels |
clang:frontend,
crash,
generated by fuzzer
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/6hsP1MKKE
```cpp
template <typename T> struct S {
enum { id = _Generic(T(), void: 1) };
};
S<void()>::s;
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/Sema/SemaExpr.cpp:1868: clang::ExprResult clang::Sema::CreateGenericSelectionExpr(clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, bool, void*, llvm::ArrayRef<clang::TypeSourceInfo*>, llvm::ArrayRef<clang::Expr*>): Assertion `ControllingExprOrType && "Must have either a controlling _expression_ or a controlling type"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:5:1: at annotation token
2. <source>:1:30: instantiating class definition 'S<void ()>'
#0 0x0000000004f4f778 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f4f778)
#1 0x0000000004f4c9d4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f4c9d4)
#2 0x0000000004f4d00c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f4d00c)
#3 0x0000000004e86d28 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x00007a5674845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x00007a567489ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#6 0x00007a567484527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x00007a56748288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x00007a567482881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x00007a567483b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x00000000095d3e51 clang::Sema::CreateGenericSelectionExpr(clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, bool, void*, llvm::ArrayRef<clang::TypeSourceInfo*>, llvm::ArrayRef<clang::Expr*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x95d3e51)
#11 0x0000000009bf2627 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformGenericSelectionExpr(clang::GenericSelectionExpr*) SemaTemplateInstantiate.cpp:0:0
#12 0x0000000009be04a6 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#13 0x0000000009beaf10 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9beaf10)
#14 0x0000000009cd342d clang::TemplateDeclInstantiator::InstantiateEnumDefinition(clang::EnumDecl*, clang::EnumDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9cd342d)
#15 0x0000000009cd7da4 clang::TemplateDeclInstantiator::VisitEnumDecl(clang::EnumDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9cd7da4)
#16 0x0000000009bf6a4f clang::Sema::InstantiateClassImpl(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9bf6a4f)
#17 0x0000000009c670a3 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9c670a3)
#18 0x0000000009cebcde void llvm::function_ref<void ()>::callback_fn<clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*)::'lambda'()>(long) SemaType.cpp:0:0
#19 0x000000000ab955b1 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xab955b1)
#20 0x0000000009d021f6 clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9d021f6)
#21 0x0000000009d0262f clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9d0262f)
#22 0x000000000925f013 clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x925f013)
#23 0x0000000009469c7b clang::Sema::getTypeName(clang::IdentifierInfo const&, clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, bool, bool, clang::OpaquePtr<clang::QualType>, bool, bool, bool, clang::ImplicitTypenameContext, clang::IdentifierInfo**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9469c7b)
#24 0x0000000009065732 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9065732)
#25 0x000000000901e1d7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x901e1d7)
#26 0x000000000901ec9f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x901ec9f)
#27 0x000000000902bbc8 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x902bbc8)
#28 0x000000000902cae5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x902cae5)
#29 0x0000000009008aaa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9008aaa)
#30 0x0000000005a4fd58 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a4fd58)
#31 0x0000000005d7a7c8 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d7a7c8)
#32 0x0000000005d0737d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d0737d)
#33 0x0000000005e51043 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e51043)
#34 0x0000000001717968 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1717968)
#35 0x000000000170e86a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#36 0x000000000170e9f3 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#37 0x0000000005ac9539 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
#38 0x0000000004e87124 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e87124)
#39 0x0000000005aca0a5 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
#40 0x0000000005a86ec2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a86ec2)
#41 0x0000000005a8a17c 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+++0x5a8a17c)
#42 0x0000000005a96675 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a96675)
#43 0x0000000001713fba clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1713fba)
#44 0x000000000169a073 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x169a073)
#45 0x00007a567482a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#46 0x00007a567482a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#47 0x000000000170e215 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x170e215)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs