| Issue |
208658
|
| Summary |
[clang] Crash in ASTContext::getUnconstrainedType when handling constrained placeholder NTTP
|
| Labels |
|
| Assignees |
|
| Reporter |
hongtaihu
|
This input is generated by a fuzzer.
```cxx
template <class> concept C = true;
template <auto &x> using A = int;
template <C auto &x> using A = int;
```
```cxx
-std=c++20 -fsyntax-only
```
Seems to be introduced since clang 17.
stacktrace:
```
clang++: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
<source>:3:13: error: constrained placeholder types other than simple 'auto' on non-type template parameters not supported yet
3 | template <C auto &x> using A = int;
| ^~~~~~~~
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ASTContext.cpp:6950: clang::QualType clang::ASTContext::getUnconstrainedType(clang::QualType) const: Assertion `!CanonT->getContainedAutoType() || !CanonT->getContainedAutoType()->isConstrained()' 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 -std=c++20 -fsyntax-only <source>
1. <eof> parser at end of file
#0 0x00000000043a2c48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43a2c48)
#1 0x000000000439fb64 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x439fb64)
#2 0x00000000043a0184 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43a0184)
#3 0x00000000042df218 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x000079d44c645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x000079d44c69eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
#6 0x000079d44c64527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x000079d44c6288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x000079d44c62881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x000079d44c63b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x0000000007c9ebf3 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7c9ebf3)
#11 0x00000000076b8d1b MatchTemplateParameterKind(clang::Sema&, clang::NamedDecl*, clang::Decl const*, clang::NamedDecl*, clang::Decl const*, bool, clang::Sema::TemplateParameterListEqualKind, clang::SourceLocation) SemaTemplate.cpp:0:0
#12 0x00000000076b9552 clang::Sema::TemplateParameterListsAreEqual(clang::Decl const*, clang::TemplateParameterList*, clang::Decl const*, clang::TemplateParameterList*, bool, clang::Sema::TemplateParameterListEqualKind, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76b9552)
#13 0x0000000007117a05 clang::Sema::ActOnAliasDeclaration(clang::Scope*, clang::AccessSpecifier, llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::SourceLocation, clang::UnqualifiedId&, clang::ParsedAttributesView const&, clang::ActionResult<clang::OpaquePtr<clang::QualType>, false>, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7117a05)
#14 0x0000000006cf0df2 clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cf0df2)
#15 0x0000000006cfedfa clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cfedfa)
#16 0x0000000006cff9b5 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cff9b5)
#17 0x0000000006daa80a clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6daa80a)
#18 0x0000000006db6fb3 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#19 0x0000000006db73aa clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6db73aa)
#20 0x0000000006ce8b30 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ce8b30)
#21 0x0000000006c9f496 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c9f496)
#22 0x0000000006ca0385 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ca0385)
#23 0x0000000006c7d27a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c7d27a)
#24 0x00000000051bd7d8 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x51bd7d8)
#25 0x000000000514b75d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x514b75d)
#26 0x000000000529506d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x529506d)
#27 0x0000000000d9f3fc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd9f3fc)
#28 0x0000000000d9600a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#29 0x0000000000d9618d 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
#30 0x0000000004f05f59 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
#31 0x00000000042df654 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42df654)
#32 0x0000000004f06a85 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
#33 0x0000000004ec1b62 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ec1b62)
#34 0x0000000004ec2b7e 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+++0x4ec2b7e)
#35 0x0000000004ececb5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ececb5)
#36 0x0000000000d9b8ea clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd9b8ea)
#37 0x0000000000cb80fa main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcb80fa)
#38 0x000079d44c62a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#39 0x000079d44c62a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#40 0x0000000000d959b5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd959b5)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs