Skip to content
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

[18 regression] Assertion Path->Access <= UnprivilegedAccess && "access along best path worse than direct?" failed. #80435

Closed
berolinux opened this issue Feb 2, 2024 · 11 comments · Fixed by #80730
Labels
c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-invalid regression

Comments

@berolinux
Copy link

This happens while trying to build kcachegrind 24.01.95:

clang-18: /home/bero/abf/llvm/BUILD/llvm-project-release-18.x/clang/lib/Sema/SemaAccess.cpp:1410: AccessResult IsAccessible(Sema &, const EffectiveContext &, AccessTarget &): Assertion `Path->Access <= UnprivilegedAccess && "access along best path worse than direct?"' 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: /usr/bin/clang-18 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name testcase.ii -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/bero/repos/packaging-tools/plasma6-kcachegrind/BUILD/kcachegrind-24.01.95/libviews -fcoverage-compilation-dir=/home/bero/repos/packaging-tools/plasma6-kcachegrind/BUILD/kcachegrind-24.01.95/libviews -resource-dir /usr/lib64/clang/18 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=13.1.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/testcase-7695c5.o -x c++-cpp-output testcase.ii
1.      <eof> parser at end of file
2.      testcase.ii:34:76: instantiating variable definition 'qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete<CallGraphView, std::false_type>>'
3.      testcase.ii:34:76: instantiating variable definition 'qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete<CallGraphView, std::false_type>>'
4.      testcase.ii:33:437: instantiating function definition 'QtPrivate::qTryMetaTypeInterfaceForType<qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete<CallGraphView, std::false_type>>'
  #0 0x00007f90b618e916 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib64/libLLVM-18.so+0x458e916)
  #1 0x00007f90b618d58a llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVM-18.so+0x458d58a)
  #2 0x00007f90b618e234 (/usr/lib64/libLLVM-18.so+0x458e234)
  #3 0x00007f90b1653690 (/usr/lib64/libc.so.6+0x3f690)
  #4 0x00007f90b16a2edc (/usr/lib64/libc.so.6+0x8eedc)
  #5 0x00007f90b16535e2 raise (/usr/lib64/libc.so.6+0x3f5e2)
  #6 0x00007f90b163c4ad abort (/usr/lib64/libc.so.6+0x284ad)
  #7 0x00007f90b163c3d5 (/usr/lib64/libc.so.6+0x283d5)
  #8 0x00007f90b164c052 (/usr/lib64/libc.so.6+0x38052)
  #9 0x00007f90bdb50afc (/usr/lib64/libclang-cpp.so.18+0x2350afc)
 #10 0x00007f90bdb4fafe (/usr/lib64/libclang-cpp.so.18+0x234fafe)
 #11 0x00007f90bdb53aa0 (/usr/lib64/libclang-cpp.so.18+0x2353aa0)
 #12 0x00007f90bdb55ffa clang::Sema::CheckLookupAccess(clang::LookupResult const&) (/usr/lib64/libclang-cpp.so.18+0x2355ffa)
 #13 0x00007f90bd07a29e (/usr/lib64/libclang-cpp.so.18+0x187a29e)
 #14 0x00007f90be0c8fcc clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec&, clang::SourceLocation, clang::NamedDecl*, clang::DeclarationNameInfo const&, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::Sema::ActOnMemberAccessExtraArgs*) (/usr/lib64/libclang-cpp.so.18+0x28c8fcc)
 #15 0x00007f90be48b556 (/usr/lib64/libclang-cpp.so.18+0x2c8b556)
 #16 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #17 0x00007f90be4b9d5d clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName, clang::CXXRecordDecl*, clang::Qualifiers, bool) (/usr/lib64/libclang-cpp.so.18+0x2cb9d5d)
 #18 0x00007f90be516e30 clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*, llvm::SmallVectorImpl<clang::ParmVarDecl*>&) (/usr/lib64/libclang-cpp.so.18+0x2d16e30)
 #19 0x00007f90be515044 clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*, clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind) (/usr/lib64/libclang-cpp.so.18+0x2d15044)
 #20 0x00007f90be4d3664 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib64/libclang-cpp.so.18+0x2cd3664)
 #21 0x00007f90be40d062 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, llvm::function_ref<bool ()>) (/usr/lib64/libclang-cpp.so.18+0x2c0d062)
 #22 0x00007f90be4100ab clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) (/usr/lib64/libclang-cpp.so.18+0x2c100ab)
 #23 0x00007f90be272fd4 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/usr/lib64/libclang-cpp.so.18+0x2a72fd4)
 #24 0x00007f90be2a8ed5 (/usr/lib64/libclang-cpp.so.18+0x2aa8ed5)
 #25 0x00007f90be2a8caf clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool) (/usr/lib64/libclang-cpp.so.18+0x2aa8caf)
 #26 0x00007f90be2a92de clang::Sema::buildOverloadedCallSet(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::OverloadCandidateSet*, clang::ActionResult<clang::Expr*, true>*) (/usr/lib64/libclang-cpp.so.18+0x2aa92de)
 #27 0x00007f90be2a99c7 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2aa99c7)
 #28 0x00007f90bdf1626f clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x271626f)
 #29 0x00007f90bdf74dff clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/usr/lib64/libclang-cpp.so.18+0x2774dff)
 #30 0x00007f90be487425 (/usr/lib64/libclang-cpp.so.18+0x2c87425)
 #31 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #32 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #33 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #34 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #35 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #36 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #37 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #38 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #39 0x00007f90be4b0635 (/usr/lib64/libclang-cpp.so.18+0x2cb0635)
 #40 0x00007f90be47fb22 (/usr/lib64/libclang-cpp.so.18+0x2c7fb22)
 #41 0x00007f90be49e79d (/usr/lib64/libclang-cpp.so.18+0x2c9e79d)
 #42 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #43 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #44 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #45 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #46 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #47 0x00007f90be4b0635 (/usr/lib64/libclang-cpp.so.18+0x2cb0635)
 #48 0x00007f90be3fdba4 (/usr/lib64/libclang-cpp.so.18+0x2bfdba4)
 #49 0x00007f90be3fcac9 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&, clang::sema::TemplateDeductionInfo&) (/usr/lib64/libclang-cpp.so.18+0x2bfcac9)
 #50 0x00007f90be4bd62d clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib64/libclang-cpp.so.18+0x2cbd62d)
 #51 0x00007f90be551080 (/usr/lib64/libclang-cpp.so.18+0x2d51080)
 #52 0x00007f90bdb3b359 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib64/libclang-cpp.so.18+0x233b359)
 #53 0x00007f90be550abd clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib64/libclang-cpp.so.18+0x2d50abd)
 #54 0x00007f90be54ff65 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib64/libclang-cpp.so.18+0x2d4ff65)
 #55 0x00007f90bdbb70c3 clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*) (/usr/lib64/libclang-cpp.so.18+0x23b70c3)
 #56 0x00007f90bdf8c544 clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&, clang::DeclarationNameInfo const&, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib64/libclang-cpp.so.18+0x278c544)
 #57 0x00007f90be4b0ead (/usr/lib64/libclang-cpp.so.18+0x2cb0ead)
 #58 0x00007f90be49e79d (/usr/lib64/libclang-cpp.so.18+0x2c9e79d)
 #59 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #60 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #61 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #62 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #63 0x00007f90be4b1700 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName) (/usr/lib64/libclang-cpp.so.18+0x2cb1700)
 #64 0x00007f90be33ec99 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/lib64/libclang-cpp.so.18+0x2b3ec99)
 #65 0x00007f90be49d097 (/usr/lib64/libclang-cpp.so.18+0x2c9d097)
 #66 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #67 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #68 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #69 0x00007f90be4b1700 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName) (/usr/lib64/libclang-cpp.so.18+0x2cb1700)
 #70 0x00007f90be315db5 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) (/usr/lib64/libclang-cpp.so.18+0x2b15db5)
 #71 0x00007f90be40cbf7 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, llvm::function_ref<bool ()>) (/usr/lib64/libclang-cpp.so.18+0x2c0cbf7)
 #72 0x00007f90be4100ab clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) (/usr/lib64/libclang-cpp.so.18+0x2c100ab)
 #73 0x00007f90be272fd4 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/usr/lib64/libclang-cpp.so.18+0x2a72fd4)
 #74 0x00007f90be271b84 (/usr/lib64/libclang-cpp.so.18+0x2a71b84)
 #75 0x00007f90be270f95 (/usr/lib64/libclang-cpp.so.18+0x2a70f95)
 #76 0x00007f90be26fc90 (/usr/lib64/libclang-cpp.so.18+0x2a6fc90)
 #77 0x00007f90be277110 (/usr/lib64/libclang-cpp.so.18+0x2a77110)
 #78 0x00007f90be286fb3 clang::Sema::AddMethodCandidate(clang::CXXMethodDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, llvm::MutableArrayRef<clang::ImplicitConversionSequence>, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a86fb3)
 #79 0x00007f90be29c4a2 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a9c4a2)
 #80 0x00007f90be29db96 clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a9db96)
 #81 0x00007f90be2acdff clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/usr/lib64/libclang-cpp.so.18+0x2aacdff)
 #82 0x00007f90be2ad37c clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib64/libclang-cpp.so.18+0x2aad37c)
 #83 0x00007f90bdfcae60 (/usr/lib64/libclang-cpp.so.18+0x27cae60)
 #84 0x00007f90be48d310 (/usr/lib64/libclang-cpp.so.18+0x2c8d310)
 #85 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #86 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #87 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #88 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #89 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #90 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #91 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #92 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #93 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #94 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #95 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #96 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #97 0x00007f90be4d3884 clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(clang::VarTemplateDecl*, clang::VarDecl*, clang::TemplateArgumentListInfo const&, llvm::ArrayRef<clang::TemplateArgument>, clang::VarTemplateSpecializationDecl*) (/usr/lib64/libclang-cpp.so.18+0x2cd3884)
 #98 0x00007f90be5210a4 clang::Sema::BuildVarTemplateInstantiation(clang::VarTemplateDecl*, clang::VarDecl*, clang::TemplateArgumentList const&, clang::TemplateArgumentListInfo const&, llvm::SmallVectorImpl<clang::TemplateArgument>&, clang::SourceLocation, llvm::SmallVector<clang::Sema::LateInstantiatedAttribute, 16u>*, clang::LocalInstantiationScope*) (/usr/lib64/libclang-cpp.so.18+0x2d210a4)
 #99 0x00007f90be359ef3 clang::Sema::CheckVarTemplateId(clang::VarTemplateDecl*, clang::SourceLocation, clang::SourceLocation, clang::TemplateArgumentListInfo const&) (/usr/lib64/libclang-cpp.so.18+0x2b59ef3)
#100 0x00007f90be3594f7 clang::Sema::CheckVarTemplateId(clang::CXXScopeSpec const&, clang::DeclarationNameInfo const&, clang::VarTemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib64/libclang-cpp.so.18+0x2b594f7)
#101 0x00007f90be359178 clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const*) (/usr/lib64/libclang-cpp.so.18+0x2b59178)
#102 0x00007f90be47fba9 (/usr/lib64/libclang-cpp.so.18+0x2c7fba9)
#103 0x00007f90be3172a6 (/usr/lib64/libclang-cpp.so.18+0x2b172a6)
#104 0x00007f90be3134d5 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/usr/lib64/libclang-cpp.so.18+0x2b134d5)
#105 0x00007f90be33e71f clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/lib64/libclang-cpp.so.18+0x2b3e71f)
#106 0x00007f90be49d097 (/usr/lib64/libclang-cpp.so.18+0x2c9d097)
#107 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
#108 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
#109 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
#110 0x00007f90be50d906 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool, llvm::ArrayRef<clang::BindingDecl*>*) (/usr/lib64/libclang-cpp.so.18+0x2d0d906)
#111 0x00007f90be4d3664 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib64/libclang-cpp.so.18+0x2cd3664)
#112 0x00007f90be496149 (/usr/lib64/libclang-cpp.so.18+0x2c96149)
#113 0x00007f90be4996ed (/usr/lib64/libclang-cpp.so.18+0x2c996ed)
#114 0x00007f90be4befb6 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib64/libclang-cpp.so.18+0x2cbefb6)
#115 0x00007f90be4ce559 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2cce559)
#116 0x00007f90be4d1492 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib64/libclang-cpp.so.18+0x2cd1492)
#117 0x00007f90be4d2f29 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2cd2f29)
#118 0x00007f90be4d15d8 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib64/libclang-cpp.so.18+0x2cd15d8)
#119 0x00007f90bdb3eb82 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib64/libclang-cpp.so.18+0x233eb82)
#120 0x00007f90bdb43175 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib64/libclang-cpp.so.18+0x2343175)
#121 0x00007f90bd143468 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib64/libclang-cpp.so.18+0x1943468)
#122 0x00007f90bd0454ce clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x18454ce)
#123 0x00007f90bf57d34b clang::FrontendAction::Execute() (/usr/lib64/libclang-cpp.so.18+0x3d7d34b)
#124 0x00007f90bf4e1799 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib64/libclang-cpp.so.18+0x3ce1799)
#125 0x00007f90bf5fc71a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclang-cpp.so.18+0x3dfc71a)
#126 0x000055cd198f9096 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-18+0x17096)
#127 0x000055cd198f4d4f (/usr/bin/clang-18+0x12d4f)
#128 0x000055cd198f361b clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-18+0x1161b)
#129 0x000055cd19903f96 main (/usr/bin/clang-18+0x21f96)
#130 0x00007f90b163dc0a (/usr/lib64/libc.so.6+0x29c0a)
#131 0x00007f90b163dcc5 __libc_start_main (/usr/lib64/libc.so.6+0x29cc5)
#132 0x000055cd198f0ed1 _start (/usr/bin/clang-18+0xeed1)

Unfortunately both creduce and cvise reduce it to invalid code.

     namespace std {
     struct      
      false_type   
     template<bool   >     struct enable_if     
     template<typename >     struct negation     ;
     template<typename... >     bool conjunction_v ;
     template<typename _Tp>     _Tp     __declval(long);
     template<typename _Tp>     auto declval()  -> decltype(__declval<_Tp>(0))
     template<typename , typename >     struct is_same     ;
     template<typename _Tp>     using decay_t = _Tp;
     template<bool _Cond>     using enable_if_t = enable_if<_Cond>::type;
     template<typename> using void_t = void;
   }
    namespace QTypeTraits {
   namespace detail {
  template<typename T> T const_reference();
  template<typename T> T reference();
  }
   template <typename, typename > struct has_ostream_operator ;
   template <typename Stream, typename T>  has_ostream_operator< T, std::void_t<decltype(detail::reference<Stream>() << detail::const_reference<T>())>>         has_ostream_operator_v ;
   }
    class QDebug;
    class QByteArrayView;
     namespace {
     template <typename _Container>          auto     data(_Container __cont) -> decltype(__cont.data)     template<typename > struct IsCompatibleByteArrayPointer       ;
   template <typename , typename = void> struct IsContainerCompatibleWithQByteArrayView ;
   template <typename T> struct IsContainerCompatibleWithQByteArrayView<T, ::enable_if_t<         std::conjunction_v<                 IsCompatibleByteArrayPointer<decltype(data(std:declval<T >()))>,                 std::negation<std::is_same<std::decay_t<T>, QByteArrayView>>>>> ;
   }
    class QByteArrayView {
   template <typename T>     using if_compatible_container =             std::enable_if_t<IsContainerCompatibleWithQByteArrayView<T>::valuebool>;
       template <typename Container, if_compatible_container<Container> = true>     QByteArrayView(Container ) ;
   };
    class QIODeviceBase {namespace QtPrivate {     class QMetaTypeInterface {}              template <typename T> struct MetatypeDecay { using type = T; };  template<typename T, bool = QTypeTraits::has_ostream_operator_v<QDebug, T>> struct QMetaTypeInterfaceWrapper ;         template<typename T, typename > struct TypeAndForceComplete {     using type = T        ; }  template<typename , typename TypeCompletePair>  QMetaTypeInterface qTryMetaTypeInterfaceForType() {     using T = TypeCompletePair:type;     using Ty = MetatypeDecay<T>::type        ;  QMetaTypeInterfaceWrapper<Ty>metaType      }  }
     template<typename Unique,typename... T> QtPrivate::QMetaTypeInterface qt_incomplete_metaTypeArray{      QtPrivate::qTryMetaTypeInterfaceForType<Unique, T>()... };
class QDebug : QIODeviceBase
    struct QDebug operator<<(QByteArrayView ) ;
}
class QWidget  {
    data;
};
class QFrame : QWidget
{};
class QAbstractScrollArea : QFrame
{};
class QGraphicsView : QAbstractScrollArea
{};
class TraceItemView
{
    data() };
class CallGraphView : QGraphicsView, TraceItemView;struct qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t CallGraphViewstaticMetaObject {
    qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t,
        QtPrivate::TypeAndForceComplete<CallGraphView, std::false_type>
    >} 

I'll try to come up with a more useful (not invalid) test case.

@nikic nikic added this to the LLVM 18.X Release milestone Feb 2, 2024
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Feb 2, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 2, 2024

@llvm/issue-subscribers-clang-frontend

Author: Bernhard Rosenkraenzer (berolinux)

This happens while trying to build kcachegrind 24.01.95:
clang-18: /home/bero/abf/llvm/BUILD/llvm-project-release-18.x/clang/lib/Sema/SemaAccess.cpp:1410: AccessResult IsAccessible(Sema &amp;, const EffectiveContext &amp;, AccessTarget &amp;): Assertion `Path-&gt;Access &lt;= UnprivilegedAccess &amp;&amp; "access along best path worse than direct?"' 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: /usr/bin/clang-18 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name testcase.ii -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/bero/repos/packaging-tools/plasma6-kcachegrind/BUILD/kcachegrind-24.01.95/libviews -fcoverage-compilation-dir=/home/bero/repos/packaging-tools/plasma6-kcachegrind/BUILD/kcachegrind-24.01.95/libviews -resource-dir /usr/lib64/clang/18 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=13.1.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/testcase-7695c5.o -x c++-cpp-output testcase.ii
1.      &lt;eof&gt; parser at end of file
2.      testcase.ii:34:76: instantiating variable definition 'qt_incomplete_metaTypeArray&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;&gt;'
3.      testcase.ii:34:76: instantiating variable definition 'qt_incomplete_metaTypeArray&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;&gt;'
4.      testcase.ii:33:437: instantiating function definition 'QtPrivate::qTryMetaTypeInterfaceForType&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;&gt;'
  #<!-- -->0 0x00007f90b618e916 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/usr/lib64/libLLVM-18.so+0x458e916)
  #<!-- -->1 0x00007f90b618d58a llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVM-18.so+0x458d58a)
  #<!-- -->2 0x00007f90b618e234 (/usr/lib64/libLLVM-18.so+0x458e234)
  #<!-- -->3 0x00007f90b1653690 (/usr/lib64/libc.so.6+0x3f690)
  #<!-- -->4 0x00007f90b16a2edc (/usr/lib64/libc.so.6+0x8eedc)
  #<!-- -->5 0x00007f90b16535e2 raise (/usr/lib64/libc.so.6+0x3f5e2)
  #<!-- -->6 0x00007f90b163c4ad abort (/usr/lib64/libc.so.6+0x284ad)
  #<!-- -->7 0x00007f90b163c3d5 (/usr/lib64/libc.so.6+0x283d5)
  #<!-- -->8 0x00007f90b164c052 (/usr/lib64/libc.so.6+0x38052)
  #<!-- -->9 0x00007f90bdb50afc (/usr/lib64/libclang-cpp.so.18+0x2350afc)
 #<!-- -->10 0x00007f90bdb4fafe (/usr/lib64/libclang-cpp.so.18+0x234fafe)
 #<!-- -->11 0x00007f90bdb53aa0 (/usr/lib64/libclang-cpp.so.18+0x2353aa0)
 #<!-- -->12 0x00007f90bdb55ffa clang::Sema::CheckLookupAccess(clang::LookupResult const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2355ffa)
 #<!-- -->13 0x00007f90bd07a29e (/usr/lib64/libclang-cpp.so.18+0x187a29e)
 #<!-- -->14 0x00007f90be0c8fcc clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec&amp;, clang::SourceLocation, clang::NamedDecl*, clang::DeclarationNameInfo const&amp;, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::Sema::ActOnMemberAccessExtraArgs*) (/usr/lib64/libclang-cpp.so.18+0x28c8fcc)
 #<!-- -->15 0x00007f90be48b556 (/usr/lib64/libclang-cpp.so.18+0x2c8b556)
 #<!-- -->16 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #<!-- -->17 0x00007f90be4b9d5d clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*, clang::MultiLevelTemplateArgumentList const&amp;, clang::SourceLocation, clang::DeclarationName, clang::CXXRecordDecl*, clang::Qualifiers, bool) (/usr/lib64/libclang-cpp.so.18+0x2cb9d5d)
 #<!-- -->18 0x00007f90be516e30 clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*, llvm::SmallVectorImpl&lt;clang::ParmVarDecl*&gt;&amp;) (/usr/lib64/libclang-cpp.so.18+0x2d16e30)
 #<!-- -->19 0x00007f90be515044 clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*, clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind) (/usr/lib64/libclang-cpp.so.18+0x2d15044)
 #<!-- -->20 0x00007f90be4d3664 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2cd3664)
 #<!-- -->21 0x00007f90be40d062 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl&lt;clang::DeducedTemplateArgument&gt;&amp;, unsigned int, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, llvm::SmallVectorImpl&lt;clang::Sema::OriginalCallArg&gt; const*, bool, llvm::function_ref&lt;bool ()&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c0d062)
 #<!-- -->22 0x00007f90be4100ab clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref&lt;bool (llvm::ArrayRef&lt;clang::QualType&gt;)&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c100ab)
 #<!-- -->23 0x00007f90be272fd4 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/usr/lib64/libclang-cpp.so.18+0x2a72fd4)
 #<!-- -->24 0x00007f90be2a8ed5 (/usr/lib64/libclang-cpp.so.18+0x2aa8ed5)
 #<!-- -->25 0x00007f90be2a8caf clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool) (/usr/lib64/libclang-cpp.so.18+0x2aa8caf)
 #<!-- -->26 0x00007f90be2a92de clang::Sema::buildOverloadedCallSet(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::OverloadCandidateSet*, clang::ActionResult&lt;clang::Expr*, true&gt;*) (/usr/lib64/libclang-cpp.so.18+0x2aa92de)
 #<!-- -->27 0x00007f90be2a99c7 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2aa99c7)
 #<!-- -->28 0x00007f90bdf1626f clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x271626f)
 #<!-- -->29 0x00007f90bdf74dff clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::Expr*) (/usr/lib64/libclang-cpp.so.18+0x2774dff)
 #<!-- -->30 0x00007f90be487425 (/usr/lib64/libclang-cpp.so.18+0x2c87425)
 #<!-- -->31 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #<!-- -->32 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->33 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->34 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->35 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->36 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->37 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->38 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->39 0x00007f90be4b0635 (/usr/lib64/libclang-cpp.so.18+0x2cb0635)
 #<!-- -->40 0x00007f90be47fb22 (/usr/lib64/libclang-cpp.so.18+0x2c7fb22)
 #<!-- -->41 0x00007f90be49e79d (/usr/lib64/libclang-cpp.so.18+0x2c9e79d)
 #<!-- -->42 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->43 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->44 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->45 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->46 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->47 0x00007f90be4b0635 (/usr/lib64/libclang-cpp.so.18+0x2cb0635)
 #<!-- -->48 0x00007f90be3fdba4 (/usr/lib64/libclang-cpp.so.18+0x2bfdba4)
 #<!-- -->49 0x00007f90be3fcac9 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&amp;, clang::sema::TemplateDeductionInfo&amp;) (/usr/lib64/libclang-cpp.so.18+0x2bfcac9)
 #<!-- -->50 0x00007f90be4bd62d clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib64/libclang-cpp.so.18+0x2cbd62d)
 #<!-- -->51 0x00007f90be551080 (/usr/lib64/libclang-cpp.so.18+0x2d51080)
 #<!-- -->52 0x00007f90bdb3b359 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref&lt;void ()&gt;) (/usr/lib64/libclang-cpp.so.18+0x233b359)
 #<!-- -->53 0x00007f90be550abd clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib64/libclang-cpp.so.18+0x2d50abd)
 #<!-- -->54 0x00007f90be54ff65 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&amp;) (/usr/lib64/libclang-cpp.so.18+0x2d4ff65)
 #<!-- -->55 0x00007f90bdbb70c3 clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&amp;, clang::DeclContext*) (/usr/lib64/libclang-cpp.so.18+0x23b70c3)
 #<!-- -->56 0x00007f90bdf8c544 clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&amp;, clang::DeclarationNameInfo const&amp;, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib64/libclang-cpp.so.18+0x278c544)
 #<!-- -->57 0x00007f90be4b0ead (/usr/lib64/libclang-cpp.so.18+0x2cb0ead)
 #<!-- -->58 0x00007f90be49e79d (/usr/lib64/libclang-cpp.so.18+0x2c9e79d)
 #<!-- -->59 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->60 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->61 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->62 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->63 0x00007f90be4b1700 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&amp;, clang::SourceLocation, clang::DeclarationName) (/usr/lib64/libclang-cpp.so.18+0x2cb1700)
 #<!-- -->64 0x00007f90be33ec99 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&amp;) (/usr/lib64/libclang-cpp.so.18+0x2b3ec99)
 #<!-- -->65 0x00007f90be49d097 (/usr/lib64/libclang-cpp.so.18+0x2c9d097)
 #<!-- -->66 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->67 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->68 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->69 0x00007f90be4b1700 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&amp;, clang::SourceLocation, clang::DeclarationName) (/usr/lib64/libclang-cpp.so.18+0x2cb1700)
 #<!-- -->70 0x00007f90be315db5 clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::TemplateArgumentLoc&amp;, clang::NamedDecl*, clang::SourceLocation, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, clang::Sema::CheckTemplateArgumentKind) (/usr/lib64/libclang-cpp.so.18+0x2b15db5)
 #<!-- -->71 0x00007f90be40cbf7 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl&lt;clang::DeducedTemplateArgument&gt;&amp;, unsigned int, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, llvm::SmallVectorImpl&lt;clang::Sema::OriginalCallArg&gt; const*, bool, llvm::function_ref&lt;bool ()&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c0cbf7)
 #<!-- -->72 0x00007f90be4100ab clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref&lt;bool (llvm::ArrayRef&lt;clang::QualType&gt;)&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c100ab)
 #<!-- -->73 0x00007f90be272fd4 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/usr/lib64/libclang-cpp.so.18+0x2a72fd4)
 #<!-- -->74 0x00007f90be271b84 (/usr/lib64/libclang-cpp.so.18+0x2a71b84)
 #<!-- -->75 0x00007f90be270f95 (/usr/lib64/libclang-cpp.so.18+0x2a70f95)
 #<!-- -->76 0x00007f90be26fc90 (/usr/lib64/libclang-cpp.so.18+0x2a6fc90)
 #<!-- -->77 0x00007f90be277110 (/usr/lib64/libclang-cpp.so.18+0x2a77110)
 #<!-- -->78 0x00007f90be286fb3 clang::Sema::AddMethodCandidate(clang::CXXMethodDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::QualType, clang::Expr::Classification, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, bool, llvm::MutableArrayRef&lt;clang::ImplicitConversionSequence&gt;, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a86fb3)
 #<!-- -->79 0x00007f90be29c4a2 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a9c4a2)
 #<!-- -->80 0x00007f90be29db96 clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a9db96)
 #<!-- -->81 0x00007f90be2acdff clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&amp;, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&amp;, llvm::ArrayRef&lt;clang::Expr*&gt;, bool) (/usr/lib64/libclang-cpp.so.18+0x2aacdff)
 #<!-- -->82 0x00007f90be2ad37c clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&amp;, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib64/libclang-cpp.so.18+0x2aad37c)
 #<!-- -->83 0x00007f90bdfcae60 (/usr/lib64/libclang-cpp.so.18+0x27cae60)
 #<!-- -->84 0x00007f90be48d310 (/usr/lib64/libclang-cpp.so.18+0x2c8d310)
 #<!-- -->85 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #<!-- -->86 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->87 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->88 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->89 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->90 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->91 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->92 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->93 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->94 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->95 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->96 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->97 0x00007f90be4d3884 clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(clang::VarTemplateDecl*, clang::VarDecl*, clang::TemplateArgumentListInfo const&amp;, llvm::ArrayRef&lt;clang::TemplateArgument&gt;, clang::VarTemplateSpecializationDecl*) (/usr/lib64/libclang-cpp.so.18+0x2cd3884)
 #<!-- -->98 0x00007f90be5210a4 clang::Sema::BuildVarTemplateInstantiation(clang::VarTemplateDecl*, clang::VarDecl*, clang::TemplateArgumentList const&amp;, clang::TemplateArgumentListInfo const&amp;, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, clang::SourceLocation, llvm::SmallVector&lt;clang::Sema::LateInstantiatedAttribute, 16u&gt;*, clang::LocalInstantiationScope*) (/usr/lib64/libclang-cpp.so.18+0x2d210a4)
 #<!-- -->99 0x00007f90be359ef3 clang::Sema::CheckVarTemplateId(clang::VarTemplateDecl*, clang::SourceLocation, clang::SourceLocation, clang::TemplateArgumentListInfo const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2b59ef3)
#<!-- -->100 0x00007f90be3594f7 clang::Sema::CheckVarTemplateId(clang::CXXScopeSpec const&amp;, clang::DeclarationNameInfo const&amp;, clang::VarTemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib64/libclang-cpp.so.18+0x2b594f7)
#<!-- -->101 0x00007f90be359178 clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&amp;, clang::SourceLocation, clang::LookupResult&amp;, bool, clang::TemplateArgumentListInfo const*) (/usr/lib64/libclang-cpp.so.18+0x2b59178)
#<!-- -->102 0x00007f90be47fba9 (/usr/lib64/libclang-cpp.so.18+0x2c7fba9)
#<!-- -->103 0x00007f90be3172a6 (/usr/lib64/libclang-cpp.so.18+0x2b172a6)
#<!-- -->104 0x00007f90be3134d5 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&amp;, bool, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, bool, bool*) (/usr/lib64/libclang-cpp.so.18+0x2b134d5)
#<!-- -->105 0x00007f90be33e71f clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&amp;) (/usr/lib64/libclang-cpp.so.18+0x2b3e71f)
#<!-- -->106 0x00007f90be49d097 (/usr/lib64/libclang-cpp.so.18+0x2c9d097)
#<!-- -->107 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
#<!-- -->108 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
#<!-- -->109 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
#<!-- -->110 0x00007f90be50d906 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool, llvm::ArrayRef&lt;clang::BindingDecl*&gt;*) (/usr/lib64/libclang-cpp.so.18+0x2d0d906)
#<!-- -->111 0x00007f90be4d3664 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2cd3664)
#<!-- -->112 0x00007f90be496149 (/usr/lib64/libclang-cpp.so.18+0x2c96149)
#<!-- -->113 0x00007f90be4996ed (/usr/lib64/libclang-cpp.so.18+0x2c996ed)
#<!-- -->114 0x00007f90be4befb6 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2cbefb6)
#<!-- -->115 0x00007f90be4ce559 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2cce559)
#<!-- -->116 0x00007f90be4d1492 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib64/libclang-cpp.so.18+0x2cd1492)
#<!-- -->117 0x00007f90be4d2f29 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2cd2f29)
#<!-- -->118 0x00007f90be4d15d8 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib64/libclang-cpp.so.18+0x2cd15d8)
#<!-- -->119 0x00007f90bdb3eb82 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib64/libclang-cpp.so.18+0x233eb82)
#<!-- -->120 0x00007f90bdb43175 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib64/libclang-cpp.so.18+0x2343175)
#<!-- -->121 0x00007f90bd143468 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/usr/lib64/libclang-cpp.so.18+0x1943468)
#<!-- -->122 0x00007f90bd0454ce clang::ParseAST(clang::Sema&amp;, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x18454ce)
#<!-- -->123 0x00007f90bf57d34b clang::FrontendAction::Execute() (/usr/lib64/libclang-cpp.so.18+0x3d7d34b)
#<!-- -->124 0x00007f90bf4e1799 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/usr/lib64/libclang-cpp.so.18+0x3ce1799)
#<!-- -->125 0x00007f90bf5fc71a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclang-cpp.so.18+0x3dfc71a)
#<!-- -->126 0x000055cd198f9096 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/usr/bin/clang-18+0x17096)
#<!-- -->127 0x000055cd198f4d4f (/usr/bin/clang-18+0x12d4f)
#<!-- -->128 0x000055cd198f361b clang_main(int, char**, llvm::ToolContext const&amp;) (/usr/bin/clang-18+0x1161b)
#<!-- -->129 0x000055cd19903f96 main (/usr/bin/clang-18+0x21f96)
#<!-- -->130 0x00007f90b163dc0a (/usr/lib64/libc.so.6+0x29c0a)
#<!-- -->131 0x00007f90b163dcc5 __libc_start_main (/usr/lib64/libc.so.6+0x29cc5)
#<!-- -->132 0x000055cd198f0ed1 _start (/usr/bin/clang-18+0xeed1)

Unfortunately both creduce and cvise reduce it to invalid code.

     namespace std {
     struct      
      false_type   
     template&lt;bool   &gt;     struct enable_if     
     template&lt;typename &gt;     struct negation     ;
     template&lt;typename... &gt;     bool conjunction_v ;
     template&lt;typename _Tp&gt;     _Tp     __declval(long);
     template&lt;typename _Tp&gt;     auto declval()  -&gt; decltype(__declval&lt;_Tp&gt;(0))
     template&lt;typename , typename &gt;     struct is_same     ;
     template&lt;typename _Tp&gt;     using decay_t = _Tp;
     template&lt;bool _Cond&gt;     using enable_if_t = enable_if&lt;_Cond&gt;::type;
     template&lt;typename&gt; using void_t = void;
   }
    namespace QTypeTraits {
   namespace detail {
  template&lt;typename T&gt; T const_reference();
  template&lt;typename T&gt; T reference();
  }
   template &lt;typename, typename &gt; struct has_ostream_operator ;
   template &lt;typename Stream, typename T&gt;  has_ostream_operator&lt; T, std::void_t&lt;decltype(detail::reference&lt;Stream&gt;() &lt;&lt; detail::const_reference&lt;T&gt;())&gt;&gt;         has_ostream_operator_v ;
   }
    class QDebug;
    class QByteArrayView;
     namespace {
     template &lt;typename _Container&gt;          auto     data(_Container __cont) -&gt; decltype(__cont.data)     template&lt;typename &gt; struct IsCompatibleByteArrayPointer       ;
   template &lt;typename , typename = void&gt; struct IsContainerCompatibleWithQByteArrayView ;
   template &lt;typename T&gt; struct IsContainerCompatibleWithQByteArrayView&lt;T, ::enable_if_t&lt;         std::conjunction_v&lt;                 IsCompatibleByteArrayPointer&lt;decltype(data(std:declval&lt;T &gt;()))&gt;,                 std::negation&lt;std::is_same&lt;std::decay_t&lt;T&gt;, QByteArrayView&gt;&gt;&gt;&gt;&gt; ;
   }
    class QByteArrayView {
   template &lt;typename T&gt;     using if_compatible_container =             std::enable_if_t&lt;IsContainerCompatibleWithQByteArrayView&lt;T&gt;::valuebool&gt;;
       template &lt;typename Container, if_compatible_container&lt;Container&gt; = true&gt;     QByteArrayView(Container ) ;
   };
    class QIODeviceBase {namespace QtPrivate {     class QMetaTypeInterface {}              template &lt;typename T&gt; struct MetatypeDecay { using type = T; };  template&lt;typename T, bool = QTypeTraits::has_ostream_operator_v&lt;QDebug, T&gt;&gt; struct QMetaTypeInterfaceWrapper ;         template&lt;typename T, typename &gt; struct TypeAndForceComplete {     using type = T        ; }  template&lt;typename , typename TypeCompletePair&gt;  QMetaTypeInterface qTryMetaTypeInterfaceForType() {     using T = TypeCompletePair:type;     using Ty = MetatypeDecay&lt;T&gt;::type        ;  QMetaTypeInterfaceWrapper&lt;Ty&gt;metaType      }  }
     template&lt;typename Unique,typename... T&gt; QtPrivate::QMetaTypeInterface qt_incomplete_metaTypeArray{      QtPrivate::qTryMetaTypeInterfaceForType&lt;Unique, T&gt;()... };
class QDebug : QIODeviceBase
    struct QDebug operator&lt;&lt;(QByteArrayView ) ;
}
class QWidget  {
    data;
};
class QFrame : QWidget
{};
class QAbstractScrollArea : QFrame
{};
class QGraphicsView : QAbstractScrollArea
{};
class TraceItemView
{
    data() };
class CallGraphView : QGraphicsView, TraceItemView;struct qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t CallGraphViewstaticMetaObject {
    qt_incomplete_metaTypeArray&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t,
        QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;
    &gt;} 

I'll try to come up with a more useful (not invalid) test case.

@shafik
Copy link
Collaborator

shafik commented Feb 2, 2024

I know you said the reduced code was invalid but I can't get it to crash: https://godbolt.org/z/r4PWYhMzd

Are there a set of flags we need?

@cor3ntin
Copy link
Contributor

cor3ntin commented Feb 2, 2024

@berolinux if it's a clang 18 regression and compiles fine with clang 17, you should be able to write your interestingness creduce test such that it returns 1/not interesting if it compiles fine with clang 17, before trying to compiling it with Clang 18

Maybe something like

#!/bin/bash -x

GOOD=clang++-17
BAD=clang++-18

$GOOD crash.cpp <FLAGS> -fsyntax-only
if [ $? -ne 0 ]
    exit 1
else
   $BAD crash.cpp <FLAGS> -fsyntax-only | grep "Path->Access <= UnprivilegedAccess"
   if [ $? -eq 0 ]
    exit 0
   fi
fi
exit 1

@berolinux
Copy link
Author

I know you said the reduced code was invalid but I can't get it to crash: https://godbolt.org/z/r4PWYhMzd

Are there a set of flags we need?

It crashes here without any flags. This is on a snapshot of release/18.x branch that is a couple of days old; maybe it has already been fixed. Will update and try again.

@Endilll
Copy link
Contributor

Endilll commented Feb 2, 2024

@berolinux can you upload full reproducer? Both preprocessed source and a script.

@berolinux
Copy link
Author

callgraphview-a506d5.cpp
callgraphview-a506d5.sh

Verified to still happen with current release/18.x

@shafik shafik added the needs-reduction Large reproducer that should be reduced into a simpler form label Feb 5, 2024
@Endilll
Copy link
Contributor

Endilll commented Feb 5, 2024

if it's a clang 18 regression and compiles fine with clang 17, you should be able to write your interestingness creduce test such that it returns 1/not interesting if it compiles fine with clang 17, before trying to compiling it with Clang 18

In my experience with creduce, lexer (pass_clex) and peephole (pass_peep) are the ones that introduce most of the additional errors while reducing. The rest of the passes may omit couple of closing braces or parentheses, but that's it most of the time. So I usually reduce without lexer and peephole passes first, then back up resulting partial reduction, then reduce with lexer and peephole passes enabled. Partial reduction helps fix the issues lexer and peephole passes introduced.

@Endilll
Copy link
Contributor

Endilll commented Feb 5, 2024

My reduction is at 61570 bytes at the moment (down from 15 MB), so I should be able to post reduced example today.

@Endilll
Copy link
Contributor

Endilll commented Feb 5, 2024

Here is reduced example, confirmed on post-18 trunk: https://godbolt.org/z/1xEPK6P6f
Reduced by me and C-Reduce:

struct QWidget  {
  void *data;
};

class TraceItemView {
  void *data;
};

struct CallGraphView : QWidget, TraceItemView {};

// comment this line and uncomment lines below
// to get the same crash without any errors emitted
decltype(CallGraphView().data) a;

// struct QByteArrayView {
//   template <typename Container, decltype(Container().data) = 0 >
//   QByteArrayView(Container);
// };

// QByteArrayView a(CallGraphView{});

Backtrace:

<source>:13:26: error: member 'data' found in multiple base classes of different types
   13 | decltype(CallGraphView().data) a;
      |                          ^
<source>:2:9: note: member found by ambiguous name lookup
    2 |   void *data;
      |         ^
<source>:6:9: note: member found by ambiguous name lookup
    6 |   void *data;
      |         ^

clang++: /root/llvm-project/clang/lib/Sema/SemaAccess.cpp:1409:
AccessResult IsAccessible(clang::Sema&, const {anonymous}::EffectiveContext&, {anonymous}::AccessTarget&):
Assertion `Path->Access <= UnprivilegedAccess && "access along best path worse than direct?"' 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: /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=gnu++17 -ferror-limit=0 -fno-color-diagnostics <source>
1.	<source>:13:33: current parser token ';'
 #0 0x0000000003884728 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3884728)
 #1 0x000000000388240c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x388240c)
 #2 0x00000000037ca8e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f1702c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f1702c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f1702c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f1702c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f1702c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f1702c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000062476a6 IsAccessible(clang::Sema&, (anonymous namespace)::EffectiveContext const&, (anonymous namespace)::AccessTarget&) SemaAccess.cpp:0:0
#10 0x0000000006247abe CheckEffectiveAccess(clang::Sema&, (anonymous namespace)::EffectiveContext const&, clang::SourceLocation, (anonymous namespace)::AccessTarget&) SemaAccess.cpp:0:0
#11 0x00000000062491fa clang::Sema::HandleDelayedAccessCheck(clang::sema::DelayedDiagnostic&, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62491fa)
#12 0x0000000006459eb2 clang::Sema::PopParsingDeclaration(clang::Sema::DelayedDiagnosticsState, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6459eb2)
#13 0x00000000060ffa64 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60ffa64)
#14 0x00000000060bd78e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60bd78e)
#15 0x00000000060bdf61 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60bdf61)
#16 0x00000000060c5226 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60c5226)
#17 0x00000000060c60cd clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60c60cd)
#18 0x00000000060b8f8a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60b8f8a)
#19 0x00000000041112b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41112b8)
#20 0x0000000004381d99 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4381d99)
#21 0x000000000430086e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x430086e)
#22 0x000000000446169e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x446169e)
#23 0x0000000000c11e56 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc11e56)
#24 0x0000000000c0966a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#25 0x0000000004152899 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
#26 0x00000000037cad94 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x37cad94)
#27 0x0000000004152e8f 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
#28 0x000000000411ab55 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x411ab55)
#29 0x000000000411b5bd 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+++0x411b5bd)
#30 0x00000000041234f5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41234f5)
#31 0x0000000000c0f1dc clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc0f1dc)
#32 0x0000000000b065c4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb065c4)
#33 0x00007f1702c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#34 0x00007f1702c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#35 0x0000000000c0914e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc0914e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@Endilll Endilll added regression crash-on-invalid confirmed Verified by a second party c++ and removed crash Prefer [crash-on-valid] or [crash-on-invalid] needs-reduction Large reproducer that should be reduced into a simpler form labels Feb 5, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 5, 2024

@llvm/issue-subscribers-c-1

Author: Bernhard Rosenkraenzer (berolinux)

This happens while trying to build kcachegrind 24.01.95:
clang-18: /home/bero/abf/llvm/BUILD/llvm-project-release-18.x/clang/lib/Sema/SemaAccess.cpp:1410: AccessResult IsAccessible(Sema &amp;, const EffectiveContext &amp;, AccessTarget &amp;): Assertion `Path-&gt;Access &lt;= UnprivilegedAccess &amp;&amp; "access along best path worse than direct?"' 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: /usr/bin/clang-18 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name testcase.ii -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/bero/repos/packaging-tools/plasma6-kcachegrind/BUILD/kcachegrind-24.01.95/libviews -fcoverage-compilation-dir=/home/bero/repos/packaging-tools/plasma6-kcachegrind/BUILD/kcachegrind-24.01.95/libviews -resource-dir /usr/lib64/clang/18 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=13.1.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/testcase-7695c5.o -x c++-cpp-output testcase.ii
1.      &lt;eof&gt; parser at end of file
2.      testcase.ii:34:76: instantiating variable definition 'qt_incomplete_metaTypeArray&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;&gt;'
3.      testcase.ii:34:76: instantiating variable definition 'qt_incomplete_metaTypeArray&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;&gt;'
4.      testcase.ii:33:437: instantiating function definition 'QtPrivate::qTryMetaTypeInterfaceForType&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t, QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;&gt;'
  #<!-- -->0 0x00007f90b618e916 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/usr/lib64/libLLVM-18.so+0x458e916)
  #<!-- -->1 0x00007f90b618d58a llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVM-18.so+0x458d58a)
  #<!-- -->2 0x00007f90b618e234 (/usr/lib64/libLLVM-18.so+0x458e234)
  #<!-- -->3 0x00007f90b1653690 (/usr/lib64/libc.so.6+0x3f690)
  #<!-- -->4 0x00007f90b16a2edc (/usr/lib64/libc.so.6+0x8eedc)
  #<!-- -->5 0x00007f90b16535e2 raise (/usr/lib64/libc.so.6+0x3f5e2)
  #<!-- -->6 0x00007f90b163c4ad abort (/usr/lib64/libc.so.6+0x284ad)
  #<!-- -->7 0x00007f90b163c3d5 (/usr/lib64/libc.so.6+0x283d5)
  #<!-- -->8 0x00007f90b164c052 (/usr/lib64/libc.so.6+0x38052)
  #<!-- -->9 0x00007f90bdb50afc (/usr/lib64/libclang-cpp.so.18+0x2350afc)
 #<!-- -->10 0x00007f90bdb4fafe (/usr/lib64/libclang-cpp.so.18+0x234fafe)
 #<!-- -->11 0x00007f90bdb53aa0 (/usr/lib64/libclang-cpp.so.18+0x2353aa0)
 #<!-- -->12 0x00007f90bdb55ffa clang::Sema::CheckLookupAccess(clang::LookupResult const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2355ffa)
 #<!-- -->13 0x00007f90bd07a29e (/usr/lib64/libclang-cpp.so.18+0x187a29e)
 #<!-- -->14 0x00007f90be0c8fcc clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec&amp;, clang::SourceLocation, clang::NamedDecl*, clang::DeclarationNameInfo const&amp;, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::Sema::ActOnMemberAccessExtraArgs*) (/usr/lib64/libclang-cpp.so.18+0x28c8fcc)
 #<!-- -->15 0x00007f90be48b556 (/usr/lib64/libclang-cpp.so.18+0x2c8b556)
 #<!-- -->16 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #<!-- -->17 0x00007f90be4b9d5d clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*, clang::MultiLevelTemplateArgumentList const&amp;, clang::SourceLocation, clang::DeclarationName, clang::CXXRecordDecl*, clang::Qualifiers, bool) (/usr/lib64/libclang-cpp.so.18+0x2cb9d5d)
 #<!-- -->18 0x00007f90be516e30 clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*, llvm::SmallVectorImpl&lt;clang::ParmVarDecl*&gt;&amp;) (/usr/lib64/libclang-cpp.so.18+0x2d16e30)
 #<!-- -->19 0x00007f90be515044 clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*, clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind) (/usr/lib64/libclang-cpp.so.18+0x2d15044)
 #<!-- -->20 0x00007f90be4d3664 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2cd3664)
 #<!-- -->21 0x00007f90be40d062 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl&lt;clang::DeducedTemplateArgument&gt;&amp;, unsigned int, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, llvm::SmallVectorImpl&lt;clang::Sema::OriginalCallArg&gt; const*, bool, llvm::function_ref&lt;bool ()&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c0d062)
 #<!-- -->22 0x00007f90be4100ab clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref&lt;bool (llvm::ArrayRef&lt;clang::QualType&gt;)&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c100ab)
 #<!-- -->23 0x00007f90be272fd4 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/usr/lib64/libclang-cpp.so.18+0x2a72fd4)
 #<!-- -->24 0x00007f90be2a8ed5 (/usr/lib64/libclang-cpp.so.18+0x2aa8ed5)
 #<!-- -->25 0x00007f90be2a8caf clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool) (/usr/lib64/libclang-cpp.so.18+0x2aa8caf)
 #<!-- -->26 0x00007f90be2a92de clang::Sema::buildOverloadedCallSet(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::OverloadCandidateSet*, clang::ActionResult&lt;clang::Expr*, true&gt;*) (/usr/lib64/libclang-cpp.so.18+0x2aa92de)
 #<!-- -->27 0x00007f90be2a99c7 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2aa99c7)
 #<!-- -->28 0x00007f90bdf1626f clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x271626f)
 #<!-- -->29 0x00007f90bdf74dff clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::Expr*) (/usr/lib64/libclang-cpp.so.18+0x2774dff)
 #<!-- -->30 0x00007f90be487425 (/usr/lib64/libclang-cpp.so.18+0x2c87425)
 #<!-- -->31 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #<!-- -->32 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->33 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->34 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->35 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->36 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->37 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->38 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->39 0x00007f90be4b0635 (/usr/lib64/libclang-cpp.so.18+0x2cb0635)
 #<!-- -->40 0x00007f90be47fb22 (/usr/lib64/libclang-cpp.so.18+0x2c7fb22)
 #<!-- -->41 0x00007f90be49e79d (/usr/lib64/libclang-cpp.so.18+0x2c9e79d)
 #<!-- -->42 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->43 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->44 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->45 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->46 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->47 0x00007f90be4b0635 (/usr/lib64/libclang-cpp.so.18+0x2cb0635)
 #<!-- -->48 0x00007f90be3fdba4 (/usr/lib64/libclang-cpp.so.18+0x2bfdba4)
 #<!-- -->49 0x00007f90be3fcac9 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&amp;, clang::sema::TemplateDeductionInfo&amp;) (/usr/lib64/libclang-cpp.so.18+0x2bfcac9)
 #<!-- -->50 0x00007f90be4bd62d clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib64/libclang-cpp.so.18+0x2cbd62d)
 #<!-- -->51 0x00007f90be551080 (/usr/lib64/libclang-cpp.so.18+0x2d51080)
 #<!-- -->52 0x00007f90bdb3b359 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref&lt;void ()&gt;) (/usr/lib64/libclang-cpp.so.18+0x233b359)
 #<!-- -->53 0x00007f90be550abd clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib64/libclang-cpp.so.18+0x2d50abd)
 #<!-- -->54 0x00007f90be54ff65 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&amp;) (/usr/lib64/libclang-cpp.so.18+0x2d4ff65)
 #<!-- -->55 0x00007f90bdbb70c3 clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&amp;, clang::DeclContext*) (/usr/lib64/libclang-cpp.so.18+0x23b70c3)
 #<!-- -->56 0x00007f90bdf8c544 clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&amp;, clang::DeclarationNameInfo const&amp;, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib64/libclang-cpp.so.18+0x278c544)
 #<!-- -->57 0x00007f90be4b0ead (/usr/lib64/libclang-cpp.so.18+0x2cb0ead)
 #<!-- -->58 0x00007f90be49e79d (/usr/lib64/libclang-cpp.so.18+0x2c9e79d)
 #<!-- -->59 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->60 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->61 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->62 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->63 0x00007f90be4b1700 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&amp;, clang::SourceLocation, clang::DeclarationName) (/usr/lib64/libclang-cpp.so.18+0x2cb1700)
 #<!-- -->64 0x00007f90be33ec99 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&amp;) (/usr/lib64/libclang-cpp.so.18+0x2b3ec99)
 #<!-- -->65 0x00007f90be49d097 (/usr/lib64/libclang-cpp.so.18+0x2c9d097)
 #<!-- -->66 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->67 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->68 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->69 0x00007f90be4b1700 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&amp;, clang::SourceLocation, clang::DeclarationName) (/usr/lib64/libclang-cpp.so.18+0x2cb1700)
 #<!-- -->70 0x00007f90be315db5 clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::TemplateArgumentLoc&amp;, clang::NamedDecl*, clang::SourceLocation, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, clang::Sema::CheckTemplateArgumentKind) (/usr/lib64/libclang-cpp.so.18+0x2b15db5)
 #<!-- -->71 0x00007f90be40cbf7 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl&lt;clang::DeducedTemplateArgument&gt;&amp;, unsigned int, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, llvm::SmallVectorImpl&lt;clang::Sema::OriginalCallArg&gt; const*, bool, llvm::function_ref&lt;bool ()&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c0cbf7)
 #<!-- -->72 0x00007f90be4100ab clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::FunctionDecl*&amp;, clang::sema::TemplateDeductionInfo&amp;, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref&lt;bool (llvm::ArrayRef&lt;clang::QualType&gt;)&gt;) (/usr/lib64/libclang-cpp.so.18+0x2c100ab)
 #<!-- -->73 0x00007f90be272fd4 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/usr/lib64/libclang-cpp.so.18+0x2a72fd4)
 #<!-- -->74 0x00007f90be271b84 (/usr/lib64/libclang-cpp.so.18+0x2a71b84)
 #<!-- -->75 0x00007f90be270f95 (/usr/lib64/libclang-cpp.so.18+0x2a70f95)
 #<!-- -->76 0x00007f90be26fc90 (/usr/lib64/libclang-cpp.so.18+0x2a6fc90)
 #<!-- -->77 0x00007f90be277110 (/usr/lib64/libclang-cpp.so.18+0x2a77110)
 #<!-- -->78 0x00007f90be286fb3 clang::Sema::AddMethodCandidate(clang::CXXMethodDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::QualType, clang::Expr::Classification, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, bool, llvm::MutableArrayRef&lt;clang::ImplicitConversionSequence&gt;, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a86fb3)
 #<!-- -->79 0x00007f90be29c4a2 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, bool, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a9c4a2)
 #<!-- -->80 0x00007f90be29db96 clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::OverloadCandidateSet&amp;, clang::OverloadCandidateParamOrder) (/usr/lib64/libclang-cpp.so.18+0x2a9db96)
 #<!-- -->81 0x00007f90be2acdff clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&amp;, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&amp;, llvm::ArrayRef&lt;clang::Expr*&gt;, bool) (/usr/lib64/libclang-cpp.so.18+0x2aacdff)
 #<!-- -->82 0x00007f90be2ad37c clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&amp;, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib64/libclang-cpp.so.18+0x2aad37c)
 #<!-- -->83 0x00007f90bdfcae60 (/usr/lib64/libclang-cpp.so.18+0x27cae60)
 #<!-- -->84 0x00007f90be48d310 (/usr/lib64/libclang-cpp.so.18+0x2c8d310)
 #<!-- -->85 0x00007f90be472f08 (/usr/lib64/libclang-cpp.so.18+0x2c72f08)
 #<!-- -->86 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->87 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->88 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->89 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->90 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->91 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->92 0x00007f90be49e842 (/usr/lib64/libclang-cpp.so.18+0x2c9e842)
 #<!-- -->93 0x00007f90be49cba5 (/usr/lib64/libclang-cpp.so.18+0x2c9cba5)
 #<!-- -->94 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
 #<!-- -->95 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
 #<!-- -->96 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
 #<!-- -->97 0x00007f90be4d3884 clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(clang::VarTemplateDecl*, clang::VarDecl*, clang::TemplateArgumentListInfo const&amp;, llvm::ArrayRef&lt;clang::TemplateArgument&gt;, clang::VarTemplateSpecializationDecl*) (/usr/lib64/libclang-cpp.so.18+0x2cd3884)
 #<!-- -->98 0x00007f90be5210a4 clang::Sema::BuildVarTemplateInstantiation(clang::VarTemplateDecl*, clang::VarDecl*, clang::TemplateArgumentList const&amp;, clang::TemplateArgumentListInfo const&amp;, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, clang::SourceLocation, llvm::SmallVector&lt;clang::Sema::LateInstantiatedAttribute, 16u&gt;*, clang::LocalInstantiationScope*) (/usr/lib64/libclang-cpp.so.18+0x2d210a4)
 #<!-- -->99 0x00007f90be359ef3 clang::Sema::CheckVarTemplateId(clang::VarTemplateDecl*, clang::SourceLocation, clang::SourceLocation, clang::TemplateArgumentListInfo const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2b59ef3)
#<!-- -->100 0x00007f90be3594f7 clang::Sema::CheckVarTemplateId(clang::CXXScopeSpec const&amp;, clang::DeclarationNameInfo const&amp;, clang::VarTemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib64/libclang-cpp.so.18+0x2b594f7)
#<!-- -->101 0x00007f90be359178 clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&amp;, clang::SourceLocation, clang::LookupResult&amp;, bool, clang::TemplateArgumentListInfo const*) (/usr/lib64/libclang-cpp.so.18+0x2b59178)
#<!-- -->102 0x00007f90be47fba9 (/usr/lib64/libclang-cpp.so.18+0x2c7fba9)
#<!-- -->103 0x00007f90be3172a6 (/usr/lib64/libclang-cpp.so.18+0x2b172a6)
#<!-- -->104 0x00007f90be3134d5 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&amp;, bool, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, llvm::SmallVectorImpl&lt;clang::TemplateArgument&gt;&amp;, bool, bool*) (/usr/lib64/libclang-cpp.so.18+0x2b134d5)
#<!-- -->105 0x00007f90be33e71f clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&amp;) (/usr/lib64/libclang-cpp.so.18+0x2b3e71f)
#<!-- -->106 0x00007f90be49d097 (/usr/lib64/libclang-cpp.so.18+0x2c9d097)
#<!-- -->107 0x00007f90be47992d (/usr/lib64/libclang-cpp.so.18+0x2c7992d)
#<!-- -->108 0x00007f90be475ba0 (/usr/lib64/libclang-cpp.so.18+0x2c75ba0)
#<!-- -->109 0x00007f90be470421 (/usr/lib64/libclang-cpp.so.18+0x2c70421)
#<!-- -->110 0x00007f90be50d906 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool, llvm::ArrayRef&lt;clang::BindingDecl*&gt;*) (/usr/lib64/libclang-cpp.so.18+0x2d0d906)
#<!-- -->111 0x00007f90be4d3664 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2cd3664)
#<!-- -->112 0x00007f90be496149 (/usr/lib64/libclang-cpp.so.18+0x2c96149)
#<!-- -->113 0x00007f90be4996ed (/usr/lib64/libclang-cpp.so.18+0x2c996ed)
#<!-- -->114 0x00007f90be4befb6 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&amp;) (/usr/lib64/libclang-cpp.so.18+0x2cbefb6)
#<!-- -->115 0x00007f90be4ce559 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2cce559)
#<!-- -->116 0x00007f90be4d1492 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib64/libclang-cpp.so.18+0x2cd1492)
#<!-- -->117 0x00007f90be4d2f29 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x2cd2f29)
#<!-- -->118 0x00007f90be4d15d8 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib64/libclang-cpp.so.18+0x2cd15d8)
#<!-- -->119 0x00007f90bdb3eb82 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib64/libclang-cpp.so.18+0x233eb82)
#<!-- -->120 0x00007f90bdb43175 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib64/libclang-cpp.so.18+0x2343175)
#<!-- -->121 0x00007f90bd143468 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/usr/lib64/libclang-cpp.so.18+0x1943468)
#<!-- -->122 0x00007f90bd0454ce clang::ParseAST(clang::Sema&amp;, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x18454ce)
#<!-- -->123 0x00007f90bf57d34b clang::FrontendAction::Execute() (/usr/lib64/libclang-cpp.so.18+0x3d7d34b)
#<!-- -->124 0x00007f90bf4e1799 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/usr/lib64/libclang-cpp.so.18+0x3ce1799)
#<!-- -->125 0x00007f90bf5fc71a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclang-cpp.so.18+0x3dfc71a)
#<!-- -->126 0x000055cd198f9096 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/usr/bin/clang-18+0x17096)
#<!-- -->127 0x000055cd198f4d4f (/usr/bin/clang-18+0x12d4f)
#<!-- -->128 0x000055cd198f361b clang_main(int, char**, llvm::ToolContext const&amp;) (/usr/bin/clang-18+0x1161b)
#<!-- -->129 0x000055cd19903f96 main (/usr/bin/clang-18+0x21f96)
#<!-- -->130 0x00007f90b163dc0a (/usr/lib64/libc.so.6+0x29c0a)
#<!-- -->131 0x00007f90b163dcc5 __libc_start_main (/usr/lib64/libc.so.6+0x29cc5)
#<!-- -->132 0x000055cd198f0ed1 _start (/usr/bin/clang-18+0xeed1)

Unfortunately both creduce and cvise reduce it to invalid code.

     namespace std {
     struct      
      false_type   
     template&lt;bool   &gt;     struct enable_if     
     template&lt;typename &gt;     struct negation     ;
     template&lt;typename... &gt;     bool conjunction_v ;
     template&lt;typename _Tp&gt;     _Tp     __declval(long);
     template&lt;typename _Tp&gt;     auto declval()  -&gt; decltype(__declval&lt;_Tp&gt;(0))
     template&lt;typename , typename &gt;     struct is_same     ;
     template&lt;typename _Tp&gt;     using decay_t = _Tp;
     template&lt;bool _Cond&gt;     using enable_if_t = enable_if&lt;_Cond&gt;::type;
     template&lt;typename&gt; using void_t = void;
   }
    namespace QTypeTraits {
   namespace detail {
  template&lt;typename T&gt; T const_reference();
  template&lt;typename T&gt; T reference();
  }
   template &lt;typename, typename &gt; struct has_ostream_operator ;
   template &lt;typename Stream, typename T&gt;  has_ostream_operator&lt; T, std::void_t&lt;decltype(detail::reference&lt;Stream&gt;() &lt;&lt; detail::const_reference&lt;T&gt;())&gt;&gt;         has_ostream_operator_v ;
   }
    class QDebug;
    class QByteArrayView;
     namespace {
     template &lt;typename _Container&gt;          auto     data(_Container __cont) -&gt; decltype(__cont.data)     template&lt;typename &gt; struct IsCompatibleByteArrayPointer       ;
   template &lt;typename , typename = void&gt; struct IsContainerCompatibleWithQByteArrayView ;
   template &lt;typename T&gt; struct IsContainerCompatibleWithQByteArrayView&lt;T, ::enable_if_t&lt;         std::conjunction_v&lt;                 IsCompatibleByteArrayPointer&lt;decltype(data(std:declval&lt;T &gt;()))&gt;,                 std::negation&lt;std::is_same&lt;std::decay_t&lt;T&gt;, QByteArrayView&gt;&gt;&gt;&gt;&gt; ;
   }
    class QByteArrayView {
   template &lt;typename T&gt;     using if_compatible_container =             std::enable_if_t&lt;IsContainerCompatibleWithQByteArrayView&lt;T&gt;::valuebool&gt;;
       template &lt;typename Container, if_compatible_container&lt;Container&gt; = true&gt;     QByteArrayView(Container ) ;
   };
    class QIODeviceBase {namespace QtPrivate {     class QMetaTypeInterface {}              template &lt;typename T&gt; struct MetatypeDecay { using type = T; };  template&lt;typename T, bool = QTypeTraits::has_ostream_operator_v&lt;QDebug, T&gt;&gt; struct QMetaTypeInterfaceWrapper ;         template&lt;typename T, typename &gt; struct TypeAndForceComplete {     using type = T        ; }  template&lt;typename , typename TypeCompletePair&gt;  QMetaTypeInterface qTryMetaTypeInterfaceForType() {     using T = TypeCompletePair:type;     using Ty = MetatypeDecay&lt;T&gt;::type        ;  QMetaTypeInterfaceWrapper&lt;Ty&gt;metaType      }  }
     template&lt;typename Unique,typename... T&gt; QtPrivate::QMetaTypeInterface qt_incomplete_metaTypeArray{      QtPrivate::qTryMetaTypeInterfaceForType&lt;Unique, T&gt;()... };
class QDebug : QIODeviceBase
    struct QDebug operator&lt;&lt;(QByteArrayView ) ;
}
class QWidget  {
    data;
};
class QFrame : QWidget
{};
class QAbstractScrollArea : QFrame
{};
class QGraphicsView : QAbstractScrollArea
{};
class TraceItemView
{
    data() };
class CallGraphView : QGraphicsView, TraceItemView;struct qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t CallGraphViewstaticMetaObject {
    qt_incomplete_metaTypeArray&lt;qt_meta_stringdata_CLASSCallGraphViewENDCLASS_t,
        QtPrivate::TypeAndForceComplete&lt;CallGraphView, std::false_type&gt;
    &gt;} 

I'll try to come up with a more useful (not invalid) test case.

@shafik
Copy link
Collaborator

shafik commented Feb 5, 2024

This is due to my change: cc1b666#diff-19c518dbc68b30c66e1a2b6bd523c005fb2050dcf1a0e92305df7ab3e1b9e9f3

I believe I know what the problem is and should have a fix up soon.

@Endilll Endilll changed the title [18 regression] Assertion `Path->Access <= UnprivilegedAccess && "access along best path worse than direct?"' failed. [18 regression] Assertion Path->Access <= UnprivilegedAccess && "access along best path worse than direct?" failed. Feb 5, 2024
shafik added a commit to shafik/llvm-project that referenced this issue Feb 5, 2024
…tempting access check.

Previously when fixing ambiguous lookup diagnostics in cc1b666
The change refactored `LookupResult` to split out diagnosing access and ambiguous
lookups. The call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
shafik added a commit to shafik/llvm-project that referenced this issue Feb 5, 2024
…tempting access check.

Previously when fixing ambiguous lookup diagnostics in cc1b666
The change refactored `LookupResult` to split out diagnosing access and ambiguous
lookups. The call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
shafik added a commit that referenced this issue Feb 5, 2024
…tempting access check. (#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: #80435
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 6, 2024
…tempting access check. (llvm#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
(cherry picked from commit a7bc9cb)
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 7, 2024
…tempting access check. (llvm#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
(cherry picked from commit a7bc9cb)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
…tempting access check. (llvm#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
(cherry picked from commit a7bc9cb)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
…tempting access check. (llvm#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
(cherry picked from commit a7bc9cb)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
…tempting access check. (llvm#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
(cherry picked from commit a7bc9cb)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
…tempting access check. (llvm#80730)

Previously when fixing ambiguous lookup diagnostics in
cc1b666 The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.

Fixes: llvm#80435
(cherry picked from commit a7bc9cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-invalid regression
Projects
7 participants