-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Clang frontend C++ crash with atomic constraints #66612
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
Comments
Assertion clang++: /root/llvm-project/clang/lib/AST/ASTContext.cpp:3442:
clang::QualType clang::ASTContext::getLValueReferenceType(clang::QualType, bool) const:
Assertion `(!T->isPlaceholderType() || T->isSpecificPlaceholderType(BuiltinType::UnknownAny)) && "Unresolved placeholder type"' 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++20 <source>
1. <source>:11:19: at annotation token
#0 0x00000000036be0a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36be0a8)
#1 0x00000000036bbd6c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36bbd6c)
#2 0x0000000003605128 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f0782c58420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f078271b00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f07826fa859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f07826fa729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f078270bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000000006cafa23 clang::ASTContext::getLValueReferenceType(clang::QualType, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cafa23)
#9 0x000000000647bddc clang::Sema::BuildExprRequirement(clang::Expr*, bool, clang::SourceLocation, clang::concepts::ExprRequirement::ReturnTypeRequirement) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x647bddc)
#10 0x000000000647c739 clang::Sema::ActOnCompoundRequirement(clang::Expr*, clang::SourceLocation, clang::CXXScopeSpec&, clang::TemplateIdAnnotation*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x647c739)
#11 0x0000000005e90b7d clang::Parser::ParseRequiresExpression() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e90b7d)
#12 0x0000000005e7d5d7 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e7d5d7)
#13 0x0000000005e8ba76 clang::Parser::ParseConstraintExpression() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e8ba76)
#14 0x0000000005f0f18c clang::Parser::ParseConceptDefinition(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f0f18c)
#15 0x0000000005f18959 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#16 0x0000000005f18b63 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f18b63)
#17 0x0000000005e56830 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e56830)
#18 0x0000000005e21694 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e21694)
#19 0x0000000005e2257d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e2257d)
#20 0x0000000005e168da clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e168da)
#21 0x000000000491e758 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x491e758)
#22 0x00000000041862e9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41862e9)
#23 0x00000000041070ee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41070ee)
#24 0x000000000426562e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x426562e)
#25 0x0000000000bd9f7e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbd9f7e)
#26 0x0000000000bd1b0a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x0000000003f685a9 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
#28 0x00000000036055d4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36055d4)
#29 0x0000000003f68b9f 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
#30 0x0000000003f30ee5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f30ee5)
#31 0x0000000003f3194d 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+++0x3f3194d)
#32 0x0000000003f39875 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f39875)
#33 0x0000000000bd76ec clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbd76ec)
#34 0x0000000000ad3ad1 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xad3ad1)
#35 0x00007f07826fc083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#36 0x0000000000bd15ee _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbd15ee)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134 |
@llvm/issue-subscribers-clang-frontend
To quickly reproduce: https://gcc.godbolt.org/z/Gc1Y17PKf (assertion-trunk)
#include <concepts>
#include <iostream>
template <typename T>
concept Iterator = requires(T a) {
{ a } -> std::same_as<T>;
};
template <typename T>
concept Container = requires(T a) {
{ std::end } -> Iterator;
}; Compiling the above code crashes clang |
Reduced to not require the STL: https://gcc.godbolt.org/z/1qa5nbhMd
|
As reported in llvm#66612, we aren't correctly treating the placeholder expression type correctly, so we ended up trying to get a reference version of it, and this resulted in an assertion, since the placeholder type cannot have a reference added. Fixes: llvm#66612
Further simplified to: https://gcc.godbolt.org/z/s1x3bqdbb (plus added a static-assert). I changed the |
To quickly reproduce: https://gcc.godbolt.org/z/Gc1Y17PKf (assertion-trunk)
Compiling the above code crashes clang
clang++ -x c++ --std=c++20
, crashes locally using clang-17.0 (a10019a), also on trunk with assertion (see godbolt link)The text was updated successfully, but these errors were encountered: