llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.36k stars 12.14k forks source link

Crash upon semantic analysis C++ code #104800

Open lopippo opened 3 months ago

lopippo commented 3 months ago

Greetings,

I use Clang as a semantic analyzer in the KDevelop IDE. There are files that make it crash. I researched the problem using 'strace kdevelop' and found that the Clang analyzer was crashing. Then I reconstructed the command line for the analysis of the culprit file and ran that command in the terminal. As per the instructions in the output of the program upon the crash, this is the crash stack (I also attach two diagnostic files, see the end):

0.      Program arguments: /usr/lib/llvm-16/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name PolChemDef.cpp -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 -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -nostdsysteminc -nobuiltininc -resource-dir /usr/lib/llvm-16/lib/clang/16 -working-directory /home/rusconi/devel/xpertmass/build-area/unix -isystem /usr/include/pappsomspp -isystem /usr/include/IsoSpec++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtXml -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -isystem /usr/include/c++/14 -isystem /usr/include/x86_64-linux-gnu/c++/14 -isystem /usr/include/c++/14/backward -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -isystem /usr/lib/llvm-16/lib/clang/16/include -imacros /tmp/kdevelop.ymvMQA -I /home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass/Core_static_autogen/include -I /home/rusconi/devel/xpertmass/development/src/XpertMass/includes/libXpertMass -Wunused-parameter -Wunreachable-code -Wall -Wno-unknown-pragmas -Wall -Wextra -Wno-gnu-zero-variadic-macro-arguments -pedantic -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -ferror-limit 100 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fsized-deallocation -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/PolChemDef-572f27.o -x c++ /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp
1.      <eof> parser at end of file
2.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1350:5: instantiating function definition 'qRegisterNormalizedMetaType<MsXpS::libXpertMass::Polymer>'
3.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1311:5: instantiating function definition 'qRegisterNormalizedMetaTypeImplementation<MsXpS::libXpertMass::Polymer>'
4.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType'
5.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType'
6.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:303:23: instantiating variable definition 'QTypeTraits::has_operator_equal_v<MsXpS::libXpertMass::Polymer>'
7.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:301:8: instantiating class definition 'QTypeTraits::has_operator_equal<MsXpS::libXpertMass::Polymer>'
8.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:213:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_container<MsXpS::libXpertMass::Polymer, false>'
9.      /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:215:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_tuple<MsXpS::libXpertMass::Polymer>'
  #0 0x00007fc4227d13ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd13ba)
  #1 0x00007fc4227cf5f4 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfcf5f4)
  #2 0x00007fc4227d1b8b (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd1b8b)
  #3 0x00007fc421256590 (/lib/x86_64-linux-gnu/libc.so.6+0x3f590)
  #4 0x00007fc42a8d0a24 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/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d0a24)
  #5 0x00007fc42a8d44d8 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d44d8)
  #6 0x00007fc42a8d617a clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d617a)
  #7 0x00007fc42a8e5af3 clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5af3)
  #8 0x00007fc42a8e5f88 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5f88)
  #9 0x00007fc42a632f88 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632f88)
 #10 0x00007fc42a632b7a clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632b7a)
 #11 0x00007fc42aa5a956 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a956)
 #12 0x00007fc42aa57c19 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57c19)
 #13 0x00007fc42aa5da9b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5da9b)
 #14 0x00007fc42aa706d7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a706d7)
 #15 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0)
 #16 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b)
 #17 0x00007fc42aa664f0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a664f0)
 #18 0x00007fc42aa741b5 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a741b5)
 #19 0x00007fc42aa7211f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a7211f)
 #20 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0)
 #21 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b)
 #22 0x00007fc42aa56f78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a56f78)
 #23 0x00007fc42aa51eeb clang::Sema::SubstTemplateArguments(llvm::ArrayRef<clang::TemplateArgumentLoc>, clang::MultiLevelTemplateArgumentList const&, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a51eeb)
 #24 0x00007fc42aa46c16 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46c16)
 #25 0x00007fc42aa46436 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46436)
 #26 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311)
 #27 0x00007fc42a9f4a56 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&, clang::sema::TemplateDeductionInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19f4a56)
 #28 0x00007fc42aa55525 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55525)
 #29 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32)
 #30 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311)
 #31 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a)
 #32 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04)
 #33 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3)
 #34 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a)
 #35 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0)
 #36 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15)
 #37 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32)
 #38 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311)
 #39 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a)
 #40 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04)
 #41 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3)
 #42 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a)
 #43 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0)
 #44 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15)
 #45 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32)
 #46 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311)
 #47 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a)
 #48 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04)
 #49 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3)
 #50 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a)
 #51 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0)
 #52 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15)
 #53 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32)
 #54 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311)
 #55 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a)
 #56 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04)
 #57 0x00007fc42a3bd17c clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x13bd17c)
 #58 0x00007fc42a608c1e clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&, clang::DeclarationNameInfo const&, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1608c1e)
 #59 0x00007fc42aa6848b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6848b)
 #60 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23)
 #61 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a)
 #62 0x00007fc42aa98080 clang::Sema::CompleteVarTemplateSpecializationDecl(clang::VarTemplateSpecializationDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98080)
 #63 0x00007fc42aa98b13 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98b13)
 #64 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311)
 #65 0x00007fc42a63ed7e (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x163ed7e)
 #66 0x00007fc42a606c6c clang::Sema::MarkDeclRefReferenced(clang::DeclRefExpr*, clang::Expr const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606c6c)
 #67 0x00007fc42a606645 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606645)
 #68 0x00007fc42a606524 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606524)
 #69 0x00007fc42a60a5c0 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&, clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x160a5c0)
 #70 0x00007fc42a957f0d clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1957f0d)
 #71 0x00007fc42aa62d78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a62d78)
 #72 0x00007fc42aa5a7bb (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a7bb)
 #73 0x00007fc42aa63283 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a63283)
 #74 0x00007fc42aa573c6 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a573c6)
 #75 0x00007fc42a9599c7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19599c7)
 #76 0x00007fc42a9507de clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19507de)
 #77 0x00007fc42a94f61d clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x194f61d)
 #78 0x00007fc42aa66b08 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a66b08)
 #79 0x00007fc42aa65e61 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a65e61)
 #80 0x00007fc42aa5838f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5838f)
 #81 0x00007fc42aa682e4 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a682e4)
 #82 0x00007fc42aa57d42 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57d42)
 #83 0x00007fc42aa60086 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a60086)
 #84 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23)
 #85 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a)
 #86 0x00007fc42aa98c3c clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98c3c)
 #87 0x00007fc42aa98eb7 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98eb7)
 #88 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68)
 #89 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f)
 #90 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68)
 #91 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f)
 #92 0x00007fc42a34704f clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x134704f)
 #93 0x00007fc42a347685 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1347685)
 #94 0x00007fc429c9865b clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc9865b)
 #95 0x00007fc429bd68fe clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbd68fe)
 #96 0x00007fc42b815d99 clang::FrontendAction::Execute() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2815d99)
 #97 0x00007fc42b790d34 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2790d34)
 #98 0x00007fc42b88f554 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x288f554)
 #99 0x000055571d9c7216 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-16/bin/clang+0x15216)
#100 0x000055571d9c4290 (/usr/lib/llvm-16/bin/clang+0x12290)
#101 0x000055571d9c3f93 clang_main(int, char**) (/usr/lib/llvm-16/bin/clang+0x11f93)
#102 0x00007fc421240c8a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#103 0x00007fc421240d45 call_init ./csu/../csu/libc-start.c:128:20
#104 0x00007fc421240d45 __libc_start_main ./csu/../csu/libc-start.c:347:5
#105 0x000055571d9c0831 _start (/usr/lib/llvm-16/bin/clang+0xe831)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Debian clang version 16.0.6 (27+b1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/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/PolChemDef-56bb0f.cpp
clang: note: diagnostic msg: /tmp/PolChemDef-56bb0f.sh
clang: note: diagnostic msg: 

And please , see the attached files (as zip archive, because GitHub refuses the files contained therein) as per instruction on the terminal. diagnostic-cpp-hpp-files.zip

Thank you for your guidance to fix this problem, most sincerely Filippo

llvmbot commented 3 months ago

@llvm/issue-subscribers-clang-frontend

Author: None (lopippo)

Greetings, I use Clang as a semantic analyzer in the KDevelop IDE. There are files that make it crash. I researched the problem using 'strace kdevelop' and found that the Clang analyzer was crashing. Then I reconstructed the command line for the analysis of the culprit file and ran that command in the terminal. As per the instructions in the output of the program upon the crash, this is the crash stack (I also attach two diagnostic files, see the end): ``` 0. Program arguments: /usr/lib/llvm-16/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name PolChemDef.cpp -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 -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -nostdsysteminc -nobuiltininc -resource-dir /usr/lib/llvm-16/lib/clang/16 -working-directory /home/rusconi/devel/xpertmass/build-area/unix -isystem /usr/include/pappsomspp -isystem /usr/include/IsoSpec++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtXml -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -isystem /usr/include/c++/14 -isystem /usr/include/x86_64-linux-gnu/c++/14 -isystem /usr/include/c++/14/backward -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -isystem /usr/lib/llvm-16/lib/clang/16/include -imacros /tmp/kdevelop.ymvMQA -I /home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass/Core_static_autogen/include -I /home/rusconi/devel/xpertmass/development/src/XpertMass/includes/libXpertMass -Wunused-parameter -Wunreachable-code -Wall -Wno-unknown-pragmas -Wall -Wextra -Wno-gnu-zero-variadic-macro-arguments -pedantic -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -ferror-limit 100 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fsized-deallocation -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/PolChemDef-572f27.o -x c++ /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp 1. <eof> parser at end of file 2. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1350:5: instantiating function definition 'qRegisterNormalizedMetaType<MsXpS::libXpertMass::Polymer>' 3. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1311:5: instantiating function definition 'qRegisterNormalizedMetaTypeImplementation<MsXpS::libXpertMass::Polymer>' 4. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType' 5. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType' 6. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:303:23: instantiating variable definition 'QTypeTraits::has_operator_equal_v<MsXpS::libXpertMass::Polymer>' 7. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:301:8: instantiating class definition 'QTypeTraits::has_operator_equal<MsXpS::libXpertMass::Polymer>' 8. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:213:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_container<MsXpS::libXpertMass::Polymer, false>' 9. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:215:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_tuple<MsXpS::libXpertMass::Polymer>' #0 0x00007fc4227d13ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd13ba) #1 0x00007fc4227cf5f4 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfcf5f4) #2 0x00007fc4227d1b8b (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd1b8b) #3 0x00007fc421256590 (/lib/x86_64-linux-gnu/libc.so.6+0x3f590) #4 0x00007fc42a8d0a24 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/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d0a24) #5 0x00007fc42a8d44d8 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d44d8) #6 0x00007fc42a8d617a clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d617a) #7 0x00007fc42a8e5af3 clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5af3) #8 0x00007fc42a8e5f88 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5f88) #9 0x00007fc42a632f88 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632f88) #10 0x00007fc42a632b7a clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632b7a) #11 0x00007fc42aa5a956 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a956) #12 0x00007fc42aa57c19 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57c19) #13 0x00007fc42aa5da9b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5da9b) #14 0x00007fc42aa706d7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a706d7) #15 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0) #16 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b) #17 0x00007fc42aa664f0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a664f0) #18 0x00007fc42aa741b5 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a741b5) #19 0x00007fc42aa7211f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a7211f) #20 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0) #21 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b) #22 0x00007fc42aa56f78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a56f78) #23 0x00007fc42aa51eeb clang::Sema::SubstTemplateArguments(llvm::ArrayRef<clang::TemplateArgumentLoc>, clang::MultiLevelTemplateArgumentList const&, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a51eeb) #24 0x00007fc42aa46c16 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46c16) #25 0x00007fc42aa46436 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46436) #26 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #27 0x00007fc42a9f4a56 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&, clang::sema::TemplateDeductionInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19f4a56) #28 0x00007fc42aa55525 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55525) #29 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #30 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #31 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #32 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #33 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #34 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #35 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #36 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #37 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #38 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #39 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #40 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #41 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #42 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #43 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #44 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #45 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #46 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #47 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #48 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #49 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #50 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #51 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #52 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #53 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #54 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #55 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #56 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #57 0x00007fc42a3bd17c clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x13bd17c) #58 0x00007fc42a608c1e clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&, clang::DeclarationNameInfo const&, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1608c1e) #59 0x00007fc42aa6848b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6848b) #60 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23) #61 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a) #62 0x00007fc42aa98080 clang::Sema::CompleteVarTemplateSpecializationDecl(clang::VarTemplateSpecializationDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98080) #63 0x00007fc42aa98b13 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98b13) #64 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #65 0x00007fc42a63ed7e (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x163ed7e) #66 0x00007fc42a606c6c clang::Sema::MarkDeclRefReferenced(clang::DeclRefExpr*, clang::Expr const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606c6c) #67 0x00007fc42a606645 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606645) #68 0x00007fc42a606524 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606524) #69 0x00007fc42a60a5c0 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&, clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x160a5c0) #70 0x00007fc42a957f0d clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1957f0d) #71 0x00007fc42aa62d78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a62d78) #72 0x00007fc42aa5a7bb (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a7bb) #73 0x00007fc42aa63283 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a63283) #74 0x00007fc42aa573c6 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a573c6) #75 0x00007fc42a9599c7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19599c7) #76 0x00007fc42a9507de clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19507de) #77 0x00007fc42a94f61d clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x194f61d) #78 0x00007fc42aa66b08 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a66b08) #79 0x00007fc42aa65e61 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a65e61) #80 0x00007fc42aa5838f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5838f) #81 0x00007fc42aa682e4 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a682e4) #82 0x00007fc42aa57d42 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57d42) #83 0x00007fc42aa60086 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a60086) #84 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23) #85 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a) #86 0x00007fc42aa98c3c clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98c3c) #87 0x00007fc42aa98eb7 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98eb7) #88 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68) #89 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f) #90 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68) #91 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f) #92 0x00007fc42a34704f clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x134704f) #93 0x00007fc42a347685 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1347685) #94 0x00007fc429c9865b clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc9865b) #95 0x00007fc429bd68fe clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbd68fe) #96 0x00007fc42b815d99 clang::FrontendAction::Execute() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2815d99) #97 0x00007fc42b790d34 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2790d34) #98 0x00007fc42b88f554 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x288f554) #99 0x000055571d9c7216 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-16/bin/clang+0x15216) #100 0x000055571d9c4290 (/usr/lib/llvm-16/bin/clang+0x12290) #101 0x000055571d9c3f93 clang_main(int, char**) (/usr/lib/llvm-16/bin/clang+0x11f93) #102 0x00007fc421240c8a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3 #103 0x00007fc421240d45 call_init ./csu/../csu/libc-start.c:128:20 #104 0x00007fc421240d45 __libc_start_main ./csu/../csu/libc-start.c:347:5 #105 0x000055571d9c0831 _start (/usr/lib/llvm-16/bin/clang+0xe831) clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal (use -v to see invocation) Debian clang version 16.0.6 (27+b1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/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/PolChemDef-56bb0f.cpp clang: note: diagnostic msg: /tmp/PolChemDef-56bb0f.sh clang: note: diagnostic msg: ``` And please , see the attached files (as zip archive, because GitHub refuses the files contained therein) as per instruction on the terminal. [diagnostic-cpp-hpp-files.zip](https://github.com/user-attachments/files/16662302/diagnostic-cpp-hpp-files.zip) Thank you for your guidance to fix this problem, most sincerely Filippo
EugeneZelenko commented 3 months ago

Could you please try 19 or main branch?

lopippo commented 3 months ago

Could you please try 19 or main branch?

Yes, I'll try to first compile the suite and then check.

One observation that I made right at the moment (do not know if that is useful) is that clangd can parse and check successfully that specific file:

clangd --check=/home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp git:(45bc1c51|) I[18:06:22.388] Debian clangd version 16.0.6 (27+b1) I[18:06:22.388] Features: linux+grpc I[18:06:22.388] PID: 2722887 I[18:06:22.388] Working directory: /home/rusconi/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin I[18:06:22.388] argv[0]: clangd I[18:06:22.388] argv[1]: --check=/home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp I[18:06:22.388] Entering check mode (no LSP server) I[18:06:22.388] Testing on source file /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp I[18:06:22.388] Loading compilation database... I[18:06:22.389] Loaded compilation database from /home/rusconi/devel/xpertmass/development/compile_commands.json I[18:06:22.389] Compile command from CDB is: /usr/bin/c++ --driver-mode=g++ -DQT_CORE_LIB -DQT_NETWORK_LIB -DQT_XML_LIB -I/home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass/Core_static_autogen/include -I/home/rusconi/devel/xpertmass/development/src/XpertMass/includes/libXpertMass -isystem /usr/include/pappsomspp -isystem /usr/include/IsoSpec++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtXml -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -g -std=gnu++17 -Wno-unknown-pragmas -Wall -pedantic -Wextra -ggdb3 -o CMakeFiles/Core_static.dir/PolChemDef.cpp.o -c -resource-dir=/usr/lib/llvm-16/lib/clang/16 -- /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp I[18:06:22.389] Giving up on broadcasting CDB, as we're shutting down I[18:06:22.389] Parsing command... I[18:06:22.390] internal (cc1) args are: -cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name PolChemDef.cpp -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 -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fcoverage-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass -resource-dir /usr/lib/llvm-16/lib/clang/16 -isystem /usr/include/pappsomspp -isystem /usr/include/IsoSpec++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtXml -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -D QT_CORE_LIB -D QT_NETWORK_LIB -D QT_XML_LIB -I /home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass/Core_static_autogen/include -I /home/rusconi/devel/xpertmass/development/src/XpertMass/includes/libXpertMass -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unknown-pragmas -Wall -Wextra -pedantic -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -no-round-trip-args -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp I[18:06:22.390] Building preamble... I[18:06:23.082] Indexing headers... I[18:06:23.270] Built preamble of size 17770316 for file /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp version null in 0.88 seconds I[18:06:23.271] Building AST... I[18:06:23.352] Indexing AST... I[18:06:23.354] Building inlay hints I[18:06:23.355] Building semantic highlighting I[18:06:23.355] Testing features at each token (may be slow in large files) E[18:06:24.664] tweak: ExtractFunction ==> FAIL: Cannot extract break/continue without corresponding loop/switch statement. I[18:06:24.724] All checks completed, 1 errors

One question: what is that 'tweak: ExtractFunction ==> FAIL: Cannot extract break/continue without corresponding loop/switch statement.' failure message ?

Most sincerely, Filippo

lopippo commented 3 months ago

Greetings, sad to say that the crash still occurs with main branch of git repo cloned today: See the attached terminal-output.txt file. Added both diagnostic files as in my first issue post. diagnostic-cpp-hpp-files.zip

Most sincerely, Filippo

Endilll commented 3 months ago

You can try to ask about new diagnostics that clangd gives you in #clangd channel on our Discord server. Let's keep this issue for the crash you reported.

lopippo commented 3 months ago

You can try to ask about new diagnostics that clangd gives you in #clangd channel on our Discord server. Let's keep this issue for the crash you reported.

Fine, thank your for your responsivenes :-) I deleted my comment above, which looked out-of-context.

[ EDIT ] I have built the whole software again (something must have failed in my first trial) and clangd works flawlessly. I confirm, however, the issue as reported initially.

Most sincerely, Filippo

Endilll commented 3 months ago

Confirmed on Clang 20.0: https://godbolt.org/z/vKeEKMEjT Reduced by me and C-Reduce:

struct Ponderable {
  void operator==(Ponderable);
};

struct PolChemDefEntity {
  void operator==(PolChemDefEntity);
};

struct Sequence {
  void operator==(Sequence);
};

struct Ionizable : PolChemDefEntity, Ponderable {
  using PolChemDefEntity::operator==;
  using Ponderable::operator==;
};

struct Polymer : Sequence, Ionizable {};

using T = decltype(Polymer{} == Polymer{});

Clang 20.0 crash:

clang++: /root/llvm-project/llvm/include/llvm/Support/Casting.h:578:
decltype(auto) llvm::cast(From*) [with To = clang::CXXMethodDecl; From = clang::NamedDecl]:
Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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 -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++17 <source>
1.  <source>:20:42: current parser token ')'
 #0 0x0000000003afa438 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3afa438)
 #1 0x0000000003af812c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3af812c)
 #2 0x0000000003a410a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000784f22c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000784f22c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000784f22c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000784f22c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000784f22c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000784f22c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000006f56c70 clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f56c70)
#10 0x0000000006f56e7b clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f56e7b)
#11 0x0000000006f5716c clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f5716c)
#12 0x0000000006f62cf0 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f62cf0)
#13 0x0000000006a81292 BuildOverloadedBinOp(clang::Sema&, clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) SemaExpr.cpp:0:0
#14 0x0000000006b04987 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b04987)
#15 0x0000000006b05081 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b05081)
#16 0x0000000006590707 clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6590707)
#17 0x00000000065938d9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65938d9)
#18 0x000000000656ff5b clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x656ff5b)
#19 0x00000000065a6cec clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65a6cec)
#20 0x00000000065166da clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65166da)
#21 0x000000000655c232 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x655c232)
#22 0x000000000655d642 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x655d642)
#23 0x0000000006564620 clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6564620)
#24 0x0000000006571e59 clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6571e59)
#25 0x000000000657bfce clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x657bfce)
#26 0x000000000657cd25 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x657cd25)
#27 0x000000000656100f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x656100f)
#28 0x000000000651de11 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651de11)
#29 0x000000000651ec9d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651ec9d)
#30 0x000000000651213a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651213a)
#31 0x000000000440ed18 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x440ed18)
#32 0x000000000469b739 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x469b739)
#33 0x000000000461fc6e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x461fc6e)
#34 0x0000000004784b6e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4784b6e)
#35 0x0000000000ca533f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xca533f)
#36 0x0000000000c9e58a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x0000000004452389 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#38 0x0000000003a41554 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a41554)
#39 0x000000000445297f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#40 0x0000000004418515 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4418515)
#41 0x0000000004418f7d 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+++0x4418f7d)
#42 0x0000000004420b95 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4420b95)
#43 0x0000000000ca2735 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xca2735)
#44 0x0000000000b76de4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb76de4)
#45 0x0000784f22c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x0000784f22c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000c9e03e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc9e03e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
llvmbot commented 3 months ago

@llvm/issue-subscribers-c-1

Author: None (lopippo)

Greetings, I use Clang as a semantic analyzer in the KDevelop IDE. There are files that make it crash. I researched the problem using 'strace kdevelop' and found that the Clang analyzer was crashing. Then I reconstructed the command line for the analysis of the culprit file and ran that command in the terminal. As per the instructions in the output of the program upon the crash, this is the crash stack (I also attach two diagnostic files, see the end): ``` 0. Program arguments: /usr/lib/llvm-16/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name PolChemDef.cpp -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 -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -nostdsysteminc -nobuiltininc -resource-dir /usr/lib/llvm-16/lib/clang/16 -working-directory /home/rusconi/devel/xpertmass/build-area/unix -isystem /usr/include/pappsomspp -isystem /usr/include/IsoSpec++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtXml -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -isystem /usr/include/c++/14 -isystem /usr/include/x86_64-linux-gnu/c++/14 -isystem /usr/include/c++/14/backward -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -isystem /usr/lib/llvm-16/lib/clang/16/include -imacros /tmp/kdevelop.ymvMQA -I /home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass/Core_static_autogen/include -I /home/rusconi/devel/xpertmass/development/src/XpertMass/includes/libXpertMass -Wunused-parameter -Wunreachable-code -Wall -Wno-unknown-pragmas -Wall -Wextra -Wno-gnu-zero-variadic-macro-arguments -pedantic -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -ferror-limit 100 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fsized-deallocation -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/PolChemDef-572f27.o -x c++ /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp 1. <eof> parser at end of file 2. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1350:5: instantiating function definition 'qRegisterNormalizedMetaType<MsXpS::libXpertMass::Polymer>' 3. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1311:5: instantiating function definition 'qRegisterNormalizedMetaTypeImplementation<MsXpS::libXpertMass::Polymer>' 4. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType' 5. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType' 6. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:303:23: instantiating variable definition 'QTypeTraits::has_operator_equal_v<MsXpS::libXpertMass::Polymer>' 7. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:301:8: instantiating class definition 'QTypeTraits::has_operator_equal<MsXpS::libXpertMass::Polymer>' 8. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:213:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_container<MsXpS::libXpertMass::Polymer, false>' 9. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:215:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_tuple<MsXpS::libXpertMass::Polymer>' #0 0x00007fc4227d13ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd13ba) #1 0x00007fc4227cf5f4 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfcf5f4) #2 0x00007fc4227d1b8b (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd1b8b) #3 0x00007fc421256590 (/lib/x86_64-linux-gnu/libc.so.6+0x3f590) #4 0x00007fc42a8d0a24 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/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d0a24) #5 0x00007fc42a8d44d8 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d44d8) #6 0x00007fc42a8d617a clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d617a) #7 0x00007fc42a8e5af3 clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5af3) #8 0x00007fc42a8e5f88 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5f88) #9 0x00007fc42a632f88 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632f88) #10 0x00007fc42a632b7a clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632b7a) #11 0x00007fc42aa5a956 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a956) #12 0x00007fc42aa57c19 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57c19) #13 0x00007fc42aa5da9b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5da9b) #14 0x00007fc42aa706d7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a706d7) #15 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0) #16 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b) #17 0x00007fc42aa664f0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a664f0) #18 0x00007fc42aa741b5 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a741b5) #19 0x00007fc42aa7211f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a7211f) #20 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0) #21 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b) #22 0x00007fc42aa56f78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a56f78) #23 0x00007fc42aa51eeb clang::Sema::SubstTemplateArguments(llvm::ArrayRef<clang::TemplateArgumentLoc>, clang::MultiLevelTemplateArgumentList const&, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a51eeb) #24 0x00007fc42aa46c16 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46c16) #25 0x00007fc42aa46436 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46436) #26 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #27 0x00007fc42a9f4a56 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&, clang::sema::TemplateDeductionInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19f4a56) #28 0x00007fc42aa55525 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55525) #29 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #30 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #31 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #32 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #33 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #34 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #35 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #36 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #37 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #38 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #39 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #40 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #41 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #42 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #43 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #44 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #45 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #46 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #47 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #48 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #49 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #50 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #51 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #52 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #53 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #54 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #55 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #56 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #57 0x00007fc42a3bd17c clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x13bd17c) #58 0x00007fc42a608c1e clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&, clang::DeclarationNameInfo const&, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1608c1e) #59 0x00007fc42aa6848b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6848b) #60 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23) #61 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a) #62 0x00007fc42aa98080 clang::Sema::CompleteVarTemplateSpecializationDecl(clang::VarTemplateSpecializationDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98080) #63 0x00007fc42aa98b13 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98b13) #64 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #65 0x00007fc42a63ed7e (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x163ed7e) #66 0x00007fc42a606c6c clang::Sema::MarkDeclRefReferenced(clang::DeclRefExpr*, clang::Expr const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606c6c) #67 0x00007fc42a606645 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606645) #68 0x00007fc42a606524 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606524) #69 0x00007fc42a60a5c0 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&, clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x160a5c0) #70 0x00007fc42a957f0d clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1957f0d) #71 0x00007fc42aa62d78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a62d78) #72 0x00007fc42aa5a7bb (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a7bb) #73 0x00007fc42aa63283 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a63283) #74 0x00007fc42aa573c6 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a573c6) #75 0x00007fc42a9599c7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19599c7) #76 0x00007fc42a9507de clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19507de) #77 0x00007fc42a94f61d clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x194f61d) #78 0x00007fc42aa66b08 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a66b08) #79 0x00007fc42aa65e61 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a65e61) #80 0x00007fc42aa5838f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5838f) #81 0x00007fc42aa682e4 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a682e4) #82 0x00007fc42aa57d42 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57d42) #83 0x00007fc42aa60086 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a60086) #84 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23) #85 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a) #86 0x00007fc42aa98c3c clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98c3c) #87 0x00007fc42aa98eb7 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98eb7) #88 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68) #89 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f) #90 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68) #91 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f) #92 0x00007fc42a34704f clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x134704f) #93 0x00007fc42a347685 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1347685) #94 0x00007fc429c9865b clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc9865b) #95 0x00007fc429bd68fe clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbd68fe) #96 0x00007fc42b815d99 clang::FrontendAction::Execute() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2815d99) #97 0x00007fc42b790d34 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2790d34) #98 0x00007fc42b88f554 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x288f554) #99 0x000055571d9c7216 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-16/bin/clang+0x15216) #100 0x000055571d9c4290 (/usr/lib/llvm-16/bin/clang+0x12290) #101 0x000055571d9c3f93 clang_main(int, char**) (/usr/lib/llvm-16/bin/clang+0x11f93) #102 0x00007fc421240c8a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3 #103 0x00007fc421240d45 call_init ./csu/../csu/libc-start.c:128:20 #104 0x00007fc421240d45 __libc_start_main ./csu/../csu/libc-start.c:347:5 #105 0x000055571d9c0831 _start (/usr/lib/llvm-16/bin/clang+0xe831) clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal (use -v to see invocation) Debian clang version 16.0.6 (27+b1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/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/PolChemDef-56bb0f.cpp clang: note: diagnostic msg: /tmp/PolChemDef-56bb0f.sh clang: note: diagnostic msg: ``` And please , see the attached files (as zip archive, because GitHub refuses the files contained therein) as per instruction on the terminal. [diagnostic-cpp-hpp-files.zip](https://github.com/user-attachments/files/16662302/diagnostic-cpp-hpp-files.zip) Thank you for your guidance to fix this problem, most sincerely Filippo
llvmbot commented 3 months ago

@llvm/issue-subscribers-c-11

Author: None (lopippo)

Greetings, I use Clang as a semantic analyzer in the KDevelop IDE. There are files that make it crash. I researched the problem using 'strace kdevelop' and found that the Clang analyzer was crashing. Then I reconstructed the command line for the analysis of the culprit file and ran that command in the terminal. As per the instructions in the output of the program upon the crash, this is the crash stack (I also attach two diagnostic files, see the end): ``` 0. Program arguments: /usr/lib/llvm-16/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name PolChemDef.cpp -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 -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -nostdsysteminc -nobuiltininc -resource-dir /usr/lib/llvm-16/lib/clang/16 -working-directory /home/rusconi/devel/xpertmass/build-area/unix -isystem /usr/include/pappsomspp -isystem /usr/include/IsoSpec++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtXml -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -isystem /usr/include/c++/14 -isystem /usr/include/x86_64-linux-gnu/c++/14 -isystem /usr/include/c++/14/backward -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -isystem /usr/lib/llvm-16/lib/clang/16/include -imacros /tmp/kdevelop.ymvMQA -I /home/rusconi/devel/xpertmass/build-area/unix/src/XpertMass/Core_static_autogen/include -I /home/rusconi/devel/xpertmass/development/src/XpertMass/includes/libXpertMass -Wunused-parameter -Wunreachable-code -Wall -Wno-unknown-pragmas -Wall -Wextra -Wno-gnu-zero-variadic-macro-arguments -pedantic -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/rusconi/devel/xpertmass/build-area/unix -ferror-limit 100 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fsized-deallocation -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/PolChemDef-572f27.o -x c++ /home/rusconi/devel/xpertmass/development/src/XpertMass/PolChemDef.cpp 1. <eof> parser at end of file 2. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1350:5: instantiating function definition 'qRegisterNormalizedMetaType<MsXpS::libXpertMass::Polymer>' 3. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:1311:5: instantiating function definition 'qRegisterNormalizedMetaTypeImplementation<MsXpS::libXpertMass::Polymer>' 4. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType' 5. /usr/include/x86_64-linux-gnu/qt6/QtCore/qmetatype.h:2475:33: instantiating variable definition 'QtPrivate::QMetaTypeInterfaceWrapper<MsXpS::libXpertMass::Polymer>::metaType' 6. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:303:23: instantiating variable definition 'QTypeTraits::has_operator_equal_v<MsXpS::libXpertMass::Polymer>' 7. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:301:8: instantiating class definition 'QTypeTraits::has_operator_equal<MsXpS::libXpertMass::Polymer>' 8. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:213:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_container<MsXpS::libXpertMass::Polymer, false>' 9. /usr/include/x86_64-linux-gnu/qt6/QtCore/qtypeinfo.h:215:8: instantiating class definition 'QTypeTraits::detail::expand_operator_equal_tuple<MsXpS::libXpertMass::Polymer>' #0 0x00007fc4227d13ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd13ba) #1 0x00007fc4227cf5f4 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfcf5f4) #2 0x00007fc4227d1b8b (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfd1b8b) #3 0x00007fc421256590 (/lib/x86_64-linux-gnu/libc.so.6+0x3f590) #4 0x00007fc42a8d0a24 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/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d0a24) #5 0x00007fc42a8d44d8 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d44d8) #6 0x00007fc42a8d617a clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18d617a) #7 0x00007fc42a8e5af3 clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5af3) #8 0x00007fc42a8e5f88 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x18e5f88) #9 0x00007fc42a632f88 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632f88) #10 0x00007fc42a632b7a clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1632b7a) #11 0x00007fc42aa5a956 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a956) #12 0x00007fc42aa57c19 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57c19) #13 0x00007fc42aa5da9b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5da9b) #14 0x00007fc42aa706d7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a706d7) #15 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0) #16 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b) #17 0x00007fc42aa664f0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a664f0) #18 0x00007fc42aa741b5 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a741b5) #19 0x00007fc42aa7211f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a7211f) #20 0x00007fc42aa4feb0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a4feb0) #21 0x00007fc42aa6769b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6769b) #22 0x00007fc42aa56f78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a56f78) #23 0x00007fc42aa51eeb clang::Sema::SubstTemplateArguments(llvm::ArrayRef<clang::TemplateArgumentLoc>, clang::MultiLevelTemplateArgumentList const&, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a51eeb) #24 0x00007fc42aa46c16 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46c16) #25 0x00007fc42aa46436 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a46436) #26 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #27 0x00007fc42a9f4a56 clang::Sema::DeduceTemplateArguments(clang::ClassTemplatePartialSpecializationDecl*, clang::TemplateArgumentList const&, clang::sema::TemplateDeductionInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19f4a56) #28 0x00007fc42aa55525 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55525) #29 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #30 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #31 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #32 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #33 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #34 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #35 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #36 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #37 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #38 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #39 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #40 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #41 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #42 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #43 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #44 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #45 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #46 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #47 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #48 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #49 0x00007fc42a560ec3 clang::Sema::CheckBaseSpecifier(clang::CXXRecordDecl*, clang::SourceRange, bool, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1560ec3) #50 0x00007fc42aa5354a clang::Sema::SubstBaseSpecifiers(clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5354a) #51 0x00007fc42aa53ac0 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a53ac0) #52 0x00007fc42aa55b15 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a55b15) #53 0x00007fc42aafef32 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1afef32) #54 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #55 0x00007fc42aaf133a clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af133a) #56 0x00007fc42aaf0b04 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1af0b04) #57 0x00007fc42a3bd17c clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x13bd17c) #58 0x00007fc42a608c1e clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&, clang::DeclarationNameInfo const&, bool, clang::Scope const*, clang::TypeSourceInfo**) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1608c1e) #59 0x00007fc42aa6848b (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a6848b) #60 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23) #61 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a) #62 0x00007fc42aa98080 clang::Sema::CompleteVarTemplateSpecializationDecl(clang::VarTemplateSpecializationDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98080) #63 0x00007fc42aa98b13 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98b13) #64 0x00007fc42a345311 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1345311) #65 0x00007fc42a63ed7e (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x163ed7e) #66 0x00007fc42a606c6c clang::Sema::MarkDeclRefReferenced(clang::DeclRefExpr*, clang::Expr const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606c6c) #67 0x00007fc42a606645 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606645) #68 0x00007fc42a606524 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1606524) #69 0x00007fc42a60a5c0 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&, clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x160a5c0) #70 0x00007fc42a957f0d clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1957f0d) #71 0x00007fc42aa62d78 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a62d78) #72 0x00007fc42aa5a7bb (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5a7bb) #73 0x00007fc42aa63283 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a63283) #74 0x00007fc42aa573c6 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a573c6) #75 0x00007fc42a9599c7 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19599c7) #76 0x00007fc42a9507de clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x19507de) #77 0x00007fc42a94f61d clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x194f61d) #78 0x00007fc42aa66b08 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a66b08) #79 0x00007fc42aa65e61 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a65e61) #80 0x00007fc42aa5838f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a5838f) #81 0x00007fc42aa682e4 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a682e4) #82 0x00007fc42aa57d42 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a57d42) #83 0x00007fc42aa60086 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a60086) #84 0x00007fc42aa54f23 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a54f23) #85 0x00007fc42aa93c2a clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a93c2a) #86 0x00007fc42aa98c3c clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98c3c) #87 0x00007fc42aa98eb7 clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a98eb7) #88 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68) #89 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f) #90 0x00007fc42aa96d68 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a96d68) #91 0x00007fc42aa9903f clang::Sema::PerformPendingInstantiations(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1a9903f) #92 0x00007fc42a34704f clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x134704f) #93 0x00007fc42a347685 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1347685) #94 0x00007fc429c9865b clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc9865b) #95 0x00007fc429bd68fe clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbd68fe) #96 0x00007fc42b815d99 clang::FrontendAction::Execute() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2815d99) #97 0x00007fc42b790d34 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2790d34) #98 0x00007fc42b88f554 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x288f554) #99 0x000055571d9c7216 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-16/bin/clang+0x15216) #100 0x000055571d9c4290 (/usr/lib/llvm-16/bin/clang+0x12290) #101 0x000055571d9c3f93 clang_main(int, char**) (/usr/lib/llvm-16/bin/clang+0x11f93) #102 0x00007fc421240c8a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3 #103 0x00007fc421240d45 call_init ./csu/../csu/libc-start.c:128:20 #104 0x00007fc421240d45 __libc_start_main ./csu/../csu/libc-start.c:347:5 #105 0x000055571d9c0831 _start (/usr/lib/llvm-16/bin/clang+0xe831) clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal (use -v to see invocation) Debian clang version 16.0.6 (27+b1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/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/PolChemDef-56bb0f.cpp clang: note: diagnostic msg: /tmp/PolChemDef-56bb0f.sh clang: note: diagnostic msg: ``` And please , see the attached files (as zip archive, because GitHub refuses the files contained therein) as per instruction on the terminal. [diagnostic-cpp-hpp-files.zip](https://github.com/user-attachments/files/16662302/diagnostic-cpp-hpp-files.zip) Thank you for your guidance to fix this problem, most sincerely Filippo
Endilll commented 3 months ago

Appears to be a regression in Clang 13: https://godbolt.org/z/8o81jT46z

lopippo commented 3 months ago

Remarquable, I need to look at C-reduce !! After one day of research I arrived at the same conclusion this night. Thank you for investigating that as quickly as that! Most sincerely, Filippo