-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrash-on-invalid
Description
Reproducer:
template <auto T> struct A {};
template <auto T> A<*T> operator *() { return {}; }Output:
clang: /llvm/clang/lib/AST/ExprClassification.cpp:57: Cl clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const: Assertion `isLValue()' failed.
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: build-main/bin/clang -fsyntax-only /tmp/clang-crash.cpp
1. /tmp/clang-crash.cpp:2:36: at annotation token
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 libLLVMSupport.so.18git 0x000014755e946f90 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 240
1 libLLVMSupport.so.18git 0x000014755e94439f llvm::sys::RunSignalHandlers() + 47
2 libLLVMSupport.so.18git 0x000014755e8492e8
3 libc.so.6 0x000014755e349520
4 libc.so.6 0x000014755e39da7c pthread_kill + 300
5 libc.so.6 0x000014755e349476 raise + 22
6 libc.so.6 0x000014755e32f7f3 abort + 211
7 libc.so.6 0x000014755e32f71b
8 libc.so.6 0x000014755e340e96
9 libclangAST.so.18git 0x000014755c85b3e3 clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const + 1219
10 libclangSema.so.18git 0x000014755b794534 clang::Sema::DeduceAutoType(clang::TypeLoc, clang::Expr*, clang::QualType&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::TemplateSpecCandidateSet*) + 2804
11 libclangSema.so.18git 0x000014755b691fed clang::Sema::CheckTemplateArgument(clang::NonTypeTemplateParmDecl*, clang::QualType, clang::Expr*, clang::TemplateArgument&, clang::TemplateArgument&, clang::Sema::CheckTemplateArgumentKind) + 1181
12 libclangSema.so.18git 0x000014755b69499d clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::TemplateArgumentLoc&, clang::NamedDecl*, clang::SourceLocation, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, clang::Sema::CheckTemplateArgumentKind) + 1485
13 libclangSema.so.18git 0x000014755b6984e7 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) + 823
14 libclangSema.so.18git 0x000014755b6a16b8 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) + 808
15 libclangSema.so.18git 0x000014755b6a3a4a clang::Sema::ActOnTemplateIdType(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo*, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, bool, bool, clang::ImplicitTypenameContext) + 1338
16 libclangParse.so.18git 0x000014755bd510f5 clang::Parser::AnnotateTemplateIdTokenAsType(clang::CXXScopeSpec&, clang::ImplicitTypenameContext, bool) + 309
17 libclangParse.so.18git 0x000014755bc8aad8 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) + 5000
18 libclangParse.so.18git 0x000014755bd52313 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 979
19 libclangParse.so.18git 0x000014755bd601c7
20 libclangParse.so.18git 0x000014755bd604a6 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 214
21 libclangParse.so.18git 0x000014755bc9926d clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) + 621
22 libclangParse.so.18git 0x000014755bd7817a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 1082
23 libclangParse.so.18git 0x000014755bd790b5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 693
24 libclangParse.so.18git 0x000014755bc66b5a clang::ParseAST(clang::Sema&, bool, bool) + 570
25 libclangFrontend.so.18git 0x00001475610e5279 clang::FrontendAction::Execute() + 201
26 libclangFrontend.so.18git 0x0000147561056315 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 405
27 libclangFrontendTool.so.18git 0x0000147562cc5145 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 421
28 clang 0x00005585bd0682b9 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 6409
29 clang 0x00005585bd0602e3
30 libclangDriver.so.18git 0x0000147560d34f6d
31 libLLVMSupport.so.18git 0x000014755e8497b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 160
32 libclangDriver.so.18git 0x0000147560d357ee
33 libclangDriver.so.18git 0x0000147560cf605a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 170
34 libclangDriver.so.18git 0x0000147560cf6b2d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 253
35 libclangDriver.so.18git 0x0000147560d05ac4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 404
36 clang 0x00005585bd0657d0 clang_main(int, char**, llvm::ToolContext const&) + 9568
37 clang 0x00005585bd05eee3 main + 51
38 libc.so.6 0x000014755e330d90
39 libc.so.6 0x000014755e330e40 __libc_start_main + 128
40 clang 0x00005585bd05ef25 _start + 37
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 18.0.0 (https://github.com/intel/llvm.git af4751738db89a142a8880c782d12d4201b222a8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /llvm/build-main/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/clang-crash-ff0ae6.cpp
clang: note: diagnostic msg: /tmp/clang-crash-ff0ae6.sh
clang: note: diagnostic msg:
********************
The issue is reproducible with the clang built with enabled assertions. I wasn't able to reproduce it with clang-17.
git bisect says that the issue is introduced by af47517.
@cor3ntin, could you take a look at this, please?
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrash-on-invalid