root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.7k stars 1.28k forks source link

ROOT 6.30.01 + C++20 crashes when interpreting specially crafted macro #14230

Closed ktf closed 4 months ago

ktf commented 10 months ago

Check duplicate issues.

Description

I am not sure what is actually happening, however the following macro:

 namespace o2::zdc
 {
  class MCLabel;
 } // namespace o2::zdc

 void readZDCDigits()
 {
   std::vector<o2::zdc::BCData> zdcBCData;
 }

crashes ROOT when compiling with C++20 enabled and loading the macro with:

root readZDCDigits.C

The same macro, when using C++17 works. The produced stacktrace is:

   ------------------------------------------------------------------
  | Welcome to ROOT 6.30/01                        https://root.cern |
  | (c) 1995-2023, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosxarm64 on Dec 14 2023, 10:22:37                   |
  | From heads/alice/v6-30-01@v6-30-01-3-g3808ff669e                 |
  | With Apple clang version 15.0.0 (clang-1500.1.0.2.5)             |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

Processing readZDCDigits.C...
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::EnterTemplatedContext(clang::Scope*, clang::DeclContext*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::EnterTemplatedContext(clang::Scope*, clang::DeclContext*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::ActOnReenterTemplateScope(clang::Decl*, llvm::function_ref<clang::Scope* ()>) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ReenterTemplateScopes(clang::Parser::MultiParseScope&, clang::Decl*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributesWithRange&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::IncrementalParser::ParseInternal(llvm::StringRef) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::Interpreter::parseForModule(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] ExecAutoParse(char const*, bool, cling::Interpreter*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TCling.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] TCling::AutoParseImplRecurse(char const*, bool) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TCling.cxx:6416
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] TCling::AutoParse(char const*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TCling.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] TClingCallbacks::LookupObject(clang::TagDecl*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TClingCallbacks.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::MultiplexInterpreterCallbacks::LookupObject(clang::TagDecl*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::MultiplexExternalSemaSource::CompleteType(clang::TagDecl*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] checkArithmeticIncompletePointerType(clang::Sema&, clang::SourceLocation, clang::Expr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] checkArithmeticBinOpPointerOperands(clang::Sema&, clang::SourceLocation, clang::Expr*, clang::Expr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::CheckSubtractionOperands(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, clang::QualType*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::CreateBuiltinBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::RebuildCXXOperatorCallExpr(clang::OverloadedOperatorKind, clang::SourceLocation, clang::Expr*, clang::Expr*, clang::Expr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXOperatorCallExpr(clang::CXXOperatorCallExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXNamedCastExpr(clang::CXXNamedCastExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformReturnStmt(clang::ReturnStmt*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] void llvm::function_ref<void ()>::callback_fn<clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool)::$_11>(long) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] MarkExprReferenced(clang::Sema&, clang::SourceLocation, clang::Decl*, clang::Expr*, bool, llvm::DenseMap<clang::VarDecl const*, int, llvm::DenseMapInfo<clang::VarDecl const*>, llvm::detail::DenseMapPair<clang::VarDecl const*, int>>&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberExpr(clang::Expr*, bool, clang::SourceLocation, clang::NestedNameSpecifierLoc, clang::SourceLocation, clang::ValueDecl*, clang::DeclAccessPair, bool, clang::DeclarationNameInfo const&, clang::QualType, clang::ExprValueKind, clang::ExprObjectKind, clang::TemplateArgumentListInfo const*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberExpr(clang::Expr*, bool, clang::SourceLocation, clang::CXXScopeSpec const*, clang::SourceLocation, clang::ValueDecl*, clang::DeclAccessPair, bool, clang::DeclarationNameInfo const&, clang::QualType, clang::ExprValueKind, clang::ExprObjectKind, clang::TemplateArgumentListInfo const*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec const&, clang::SourceLocation, clang::NamedDecl*, clang::LookupResult&, clang::TemplateArgumentListInfo const*, clang::Scope const*, bool, clang::Sema::ActOnMemberAccessExtraArgs*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformMemberExpr(clang::MemberExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXOperatorCallExpr(clang::CXXOperatorCallExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr* const*, unsigned int, bool, llvm::SmallVectorImpl<clang::Expr*>&, bool*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] void llvm::function_ref<void ()>::callback_fn<clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool)::$_11>(long) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] MarkExprReferenced(clang::Sema&, clang::SourceLocation, clang::Decl*, clang::Expr*, bool, llvm::DenseMap<clang::VarDecl const*, int, llvm::DenseMapInfo<clang::VarDecl const*>, llvm::detail::DenseMapPair<clang::VarDecl const*, int>>&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberExpr(clang::Expr*, bool, clang::SourceLocation, clang::NestedNameSpecifierLoc, clang::SourceLocation, clang::ValueDecl*, clang::DeclAccessPair, bool, clang::DeclarationNameInfo const&, clang::QualType, clang::ExprValueKind, clang::ExprObjectKind, clang::TemplateArgumentListInfo const*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberExpr(clang::Expr*, bool, clang::SourceLocation, clang::CXXScopeSpec const*, clang::SourceLocation, clang::ValueDecl*, clang::DeclAccessPair, bool, clang::DeclarationNameInfo const&, clang::QualType, clang::ExprValueKind, clang::ExprObjectKind, clang::TemplateArgumentListInfo const*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec const&, clang::SourceLocation, clang::NamedDecl*, clang::LookupResult&, clang::TemplateArgumentListInfo const*, clang::Scope const*, bool, clang::Sema::ActOnMemberAccessExtraArgs*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec&, clang::SourceLocation, clang::NamedDecl*, clang::DeclarationNameInfo const&, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::Sema::ActOnMemberAccessExtraArgs*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXDependentScopeMemberExpr(clang::CXXDependentScopeMemberExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] void llvm::function_ref<void ()>::callback_fn<clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool)::$_11>(long) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] MarkExprReferenced(clang::Sema&, clang::SourceLocation, clang::Decl*, clang::Expr*, bool, llvm::DenseMap<clang::VarDecl const*, int, llvm::DenseMapInfo<clang::VarDecl const*>, llvm::detail::DenseMapPair<clang::VarDecl const*, int>>&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] CreateFunctionRefExpr(clang::Sema&, clang::FunctionDecl*, clang::NamedDecl*, clang::Expr const*, bool, clang::SourceLocation, clang::DeclarationNameLoc const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] void llvm::function_ref<void ()>::callback_fn<clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool)::$_11>(long) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::FinalizeVarWithDestructor(clang::VarDecl*, clang::RecordType const*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Sema::ActOnUninitializedDecl(clang::Decl*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributesWithRange&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseCompoundStatementBody(bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::IncrementalParser::ParseInternal(llvm::StringRef) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::Interpreter::loadHeader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, cling::Transaction**) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::MetaSema::actOnLCommand(llvm::StringRef, cling::Transaction**) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TCling.cxx:2445
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TCling.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCling.6.30.01.so] TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/metacling/src/TCling.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libCore.6.30.01.so] TApplication::ExecuteFile(char const*, int*, bool) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/base/src/TApplication.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libRint.6.30.01.so] TRint::ProcessLineNr(char const*, char const*, int*) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/rint/src/TRint.cxx:820
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/lib/libRint.6.30.01.so] TRint::Run(bool) /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/core/rint/src/TRint.cxx:0
[/Users/ktf/src/sw/osx_arm64/ROOT/alice-v6-30-01-local6/bin/root.exe] main /Users/ktf/src/sw/SOURCES/ROOT/alice-v6-30-01/0/main/src/rmain.cxx:86
[/usr/lib/dyld] start (no debug info)

Notice that every bit of that script seems to be necessary.

Reproducer

→ root -b -q
   ------------------------------------------------------------------
  | Welcome to ROOT 6.30/01                        https://root.cern |
  | (c) 1995-2023, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosxarm64 on Dec 14 2023, 10:22:37                   |
  | From heads/alice/v6-30-01@v6-30-01-3-g3808ff669e                 |
  | With Apple clang version 15.0.0 (clang-1500.1.0.2.5)             |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

ROOT version

Both 6.28.04 and 6.30.01 have the same issue, with or without ALICE specific patches. The issue seems to be C++20 related.

Installation method

aliBuild

Operating system

macOS, Linux

Additional context

No response

ktf commented 10 months ago

Does anyone have an hint of what might be happening? This is preventing ALICE to switch to C++20.

vgvassilev commented 10 months ago

That's probably a bug in our forward declaration state restore logic. @Axel-Naumann used to be taking care of these issues, generally.

ktf commented 10 months ago

For the record, this is also both on linux and macOS alike.

ktf commented 10 months ago

Notice also that there are multiple classes called "MCLabel" in different namespaces.

vgvassilev commented 10 months ago

If you add the includes for o2::zdc::BCData and other entities that this macro uses?

ktf commented 10 months ago

Yes, indeed for this particular case it helps. It also helps for some of the actual things which are failings in our builds (but not all of them).

ktf commented 10 months ago

How can we proceed with this?

hahnjo commented 10 months ago

@ktf ideally we need a standalone reproducer that does not depend on the ALICE environment. Next we should verify if the problem still exists in current master after the upgrade to LLVM 16. In principle, this could also happen independently, if it is feasible to build an ALICE environment with a version of ROOT master... The reason for this step is that we know about certain problems in the C++20 support with LLVM 13; if it's fixed in LLVM 16, we can potentially hunt down the fix and backport it - no guarantees though, we also already know about certain changes that cannot be backported due to heavily different code bases.

ktf commented 10 months ago

Is there a way I can easily create a standalone reproducer? E.g. something which dumps the internal state at load and a self contained sourcefile?

IMHO it would be much easier if you could bootstrap the ALICE environment and have a look at the problem directly or, if you are at CERN, we can sit together and single step with a debug build.

I actually see different stacktraces, but what seems to be common is that they all crash in EnterTemplatedContext. Also notice that for some of the cases it does not always crash, possibly indicating some memory corruption.

I do not have any means for now to move to master.

hahnjo commented 10 months ago

Is there a way I can easily create a standalone reproducer? E.g. something which dumps the internal state at load and a self contained sourcefile?

No, this is a manual process.

IMHO it would be much easier if you could bootstrap the ALICE environment and have a look at the problem directly or, if you are at CERN, we can sit together and single step with a debug build.

This is exactly what I do not want to do; debugging LLVM / Clang / Cling internals inside of an experiment framework is a really time-consuming exercise and should be the very last resort. Any effort that can get us around that time sink will get a solution faster and in a much straighter line.

I actually see different stacktraces, but what seems to be common is that they all crash in EnterTemplatedContext. Also notice that for some of the cases it does not always crash, possibly indicating some memory corruption.

I do not have any means for now to move to master.

That's not quite ideal, even not for testing purposes? As I said, we know that LLVM 13 has deficiencies related to C++20 and it's not even clear if a fix could be backported...

ktf commented 10 months ago

No, this is a manual process.

This would probably be a very nice GSoC (or similar) project, actually.

This is exactly what I do not want to do; debugging LLVM / Clang / Cling internals inside of an experiment framework is a really time-consuming exercise and should be the very last resort. Any effort that can get us around that time sink will get a solution faster and in a much straighter line.

Depends on the experiment, I guess. ;-) Our stack builds quite nicely (including precompiled binaries for supported architectures).

That's not quite ideal, even not for testing purposes?

Well, let's see... https://github.com/alisw/alidist/pull/5304 is what is needed. Obviously "move production to master" is not an option.

As I said, we know that LLVM 13 has deficiencies related to C++20 and it's not even clear if a fix could be backported.

To be clear, the whole stack has zero C++20 code in it (we simply turn on -std=c++20 everywhere). I think this is a genuine memory corruption when dealing with forward declarations (when C++20 support is enabled).

hahnjo commented 10 months ago

No, this is a manual process.

This would probably be a very nice GSoC (or similar) project, actually.

Hm maybe, we would need to trace all pcms + headers loaded into Cling and bundle them up when dumping...

This is exactly what I do not want to do; debugging LLVM / Clang / Cling internals inside of an experiment framework is a really time-consuming exercise and should be the very last resort. Any effort that can get us around that time sink will get a solution faster and in a much straighter line.

Depends on the experiment, I guess. ;-) Our stack builds quite nicely (including precompiled binaries for supported architectures).

Yes, fair point. Though it's not only about building, but debugging any complex software product can become quite hairy (and debugging LLVM and Clang is already complicated on its own)

That's not quite ideal, even not for testing purposes?

Well, let's see... alisw/alidist#5304 is what is needed. Obviously "move production to master" is not an option.

Sure, that's clear. So far I've mostly worked with CMS and they have special builds that can produce, my understanding is that ATLAS something similar, so working out the option might be very useful for all sorts of investigations!

As I said, we know that LLVM 13 has deficiencies related to C++20 and it's not even clear if a fix could be backported.

To be clear, the whole stack has zero C++20 code in it (we simply turn on -std=c++20 everywhere). I think this is a genuine memory corruption when dealing with forward declarations (when C++20 support is enabled).

I agree. The question is who is causing that, ie is ROOT producing legitimate code that Clang crashes on?

ktf commented 10 months ago

@hahnjo master dies with:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
XROOTD_UTILS_LIBRARIES
    linked by target "NetxNG" in directory /sw/SOURCES/ROOT/master/a1f54ed694/net/netxng

any idea of what is missing? What is XROOTD_UTILS_LIBRARIES?

hahnjo commented 10 months ago

@ktf this may be https://github.com/root-project/root/pull/14180 - which version of XRootD do you have?

ktf commented 10 months ago

v5.6.0 ... let me retry with v5.6.4

hahnjo commented 9 months ago

@ktf any updates on this, did it work? Alternatively is there a debug version installed that I can run on lxplus or such? While I said that I would like to avoid debugging LLVM / Clang / Cling from within the experiment framework, maybe I can get enough information to "guess" a standalone reproducer. Particularly interesting would be what code is passed to cling::IncrementalParser::Compile (assuming it's indeed a crash inside Clang)...

ktf commented 9 months ago

Find here the dump by instrumenting cling::IncrementalParser::Compile.

compile.txt

ktf commented 9 months ago

For the record, it seems to still fail, even with the master of ROOT:

https://ali-ci.cern.ch/alice-build-logs/alisw/alidist/5304/70eb40c1ad3b21cb1f8b79b556868edaf4059147/build_O2_alidist/fullLog.txt

ktf commented 9 months ago

The relevant stacktraces seem to be:

#6  0x00007f63165d6483 in clang::Sema::getTemplateDepth(clang::Scope*) const () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#7  0x00007f6316011655 in clang::Sema::EnterTemplatedContext(clang::Scope*, clang::DeclContext*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#8  0x00007f63160e0101 in clang::Sema::ActOnReenterTemplateScope(clang::Decl*, llvm::function_ref<clang::Scope* ()>) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#9  0x00007f6315ce22c9 in clang::Parser::ReenterTemplateScopes(clang::Parser::MultiParseScope&, clang::Decl*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#10 0x00007f6315d0772c in clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#11 0x00007f6315d075dd in clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#12 0x00007f6315c4c8cb in clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so

and

#6  0x00007f042c7fab68 in clang::Sema::hasAcceptableDefinition(clang::NamedDecl*, clang::NamedDecl**, clang::Sema::AcceptableKind, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#7  0x00007f042c7fbf91 in clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#8  0x00007f042c57721b in IsUserDefinedConversion(clang::Sema&, clang::Expr*, clang::QualType, clang::UserDefinedConversionSequence&, clang::OverloadCandidateSet&, clang::Sema::AllowedExplicit, bool) [clone .constprop.0] () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#9  0x00007f042c577dc0 in TryUserDefinedConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) [clone .constprop.0] () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#10 0x00007f042c578644 in TryImplicitConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#11 0x00007f042c578938 in TryReferenceInit(clang::Sema&, clang::Expr*, clang::QualType, clang::SourceLocation, bool, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#12 0x00007f042c57a3c6 in TryCopyInitialization(clang::Sema&, clang::Expr*, clang::QualType, bool, bool, bool, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#13 0x00007f042c5741a0 in clang::Sema::AddOverloadCandidate(clang::FunctionDecl*, clang::DeclAccessPair, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, bool, clang::CallExpr::ADLCallKind, llvm::MutableArrayRef<clang::ImplicitConversionSequence>, clang::OverloadCandidateParamOrder) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#14 0x00007f042c57599e in clang::Sema::AddNonMemberOperatorCandidates(clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::TemplateArgumentListInfo*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#15 0x00007f042c584a40 in clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#16 0x00007f042c590463 in clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
hahnjo commented 9 months ago

Find here the dump by instrumenting cling::IncrementalParser::Compile.

compile.txt

Thanks for that; I had a quick look already yesterday afternoon, but couldn't spot anything obviously wrong. From the ParseCXXMemberSpecification debug printouts, it appears the class it's tripping on is Rotation2D, but there I cannot spot much wrong either...

For the record, it seems to still fail, even with the master of ROOT:

https://ali-ci.cern.ch/alice-build-logs/alisw/alidist/5304/70eb40c1ad3b21cb1f8b79b556868edaf4059147/build_O2_alidist/fullLog.txt

Okay, too bad (I cannot access the log because of permission problems, but probably no new relevant information there).

The relevant stacktraces seem to be:

#6  0x00007f63165d6483 in clang::Sema::getTemplateDepth(clang::Scope*) const () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#7  0x00007f6316011655 in clang::Sema::EnterTemplatedContext(clang::Scope*, clang::DeclContext*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#8  0x00007f63160e0101 in clang::Sema::ActOnReenterTemplateScope(clang::Decl*, llvm::function_ref<clang::Scope* ()>) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#9  0x00007f6315ce22c9 in clang::Parser::ReenterTemplateScopes(clang::Parser::MultiParseScope&, clang::Decl*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#10 0x00007f6315d0772c in clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#11 0x00007f6315d075dd in clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#12 0x00007f6315c4c8cb in clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so

and

#6  0x00007f042c7fab68 in clang::Sema::hasAcceptableDefinition(clang::NamedDecl*, clang::NamedDecl**, clang::Sema::AcceptableKind, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#7  0x00007f042c7fbf91 in clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#8  0x00007f042c57721b in IsUserDefinedConversion(clang::Sema&, clang::Expr*, clang::QualType, clang::UserDefinedConversionSequence&, clang::OverloadCandidateSet&, clang::Sema::AllowedExplicit, bool) [clone .constprop.0] () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#9  0x00007f042c577dc0 in TryUserDefinedConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) [clone .constprop.0] () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#10 0x00007f042c578644 in TryImplicitConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#11 0x00007f042c578938 in TryReferenceInit(clang::Sema&, clang::Expr*, clang::QualType, clang::SourceLocation, bool, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#12 0x00007f042c57a3c6 in TryCopyInitialization(clang::Sema&, clang::Expr*, clang::QualType, bool, bool, bool, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#13 0x00007f042c5741a0 in clang::Sema::AddOverloadCandidate(clang::FunctionDecl*, clang::DeclAccessPair, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, bool, clang::CallExpr::ADLCallKind, llvm::MutableArrayRef<clang::ImplicitConversionSequence>, clang::OverloadCandidateParamOrder) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#14 0x00007f042c57599e in clang::Sema::AddNonMemberOperatorCandidates(clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::TemplateArgumentListInfo*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#15 0x00007f042c584a40 in clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so
#16 0x00007f042c590463 in clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) () from /sw/slc7_x86-64/ROOT/master-local3/lib/libCling.so

Right; I guess this means we do have to get some more information from a debugger. Is there a debug version that I can load up on lxplus or would this only be possible if the two of us sit together?

ktf commented 9 months ago

it appears the class it's tripping on is Rotation2D, but there I cannot spot much wrong either

How can you tell? That said I tried adding explicitly #include "MathUtils/Cartesian.h" without much luck.

ktf commented 9 months ago

Okay, too bad (I cannot access the log because of permission problems, but probably no new relevant information there).

Yes, I imagined that and copied the relevant stacktraces.

Right; I guess this means we do have to get some more information from a debugger. Is there a debug version that I can load up on lxplus or would this only be possible if the two of us sit together?

We can try next week. I will in the meanwhile try to do a debug build on CVMFS.

hahnjo commented 9 months ago

it appears the class it's tripping on is Rotation2D, but there I cannot spot much wrong either

How can you tell? That said I tried adding explicitly #include "MathUtils/Cartesian.h" without much luck.

The last ParseCXXMemberSpecification mentions MathUtils/Cartesian.h:61, but maybe I'm jumping the investigations here... Let's see next week maybe.

ktf commented 9 months ago

Right... Anyways, including the header does not help.

vgvassilev commented 9 months ago

@hahnjo, if you look at the diff from our llvm fork you will see a bunch of work done in the area of RAII objects. That's there to be able to store and restore the compiler state so that it can jump to loading a header file on demand and continue parsing. I'd bet my money that something is not stored/restored with the new version of llvm...

hahnjo commented 7 months ago

@hahnjo, if you look at the diff from our llvm fork you will see a bunch of work done in the area of RAII objects. That's there to be able to store and restore the compiler state so that it can jump to loading a header file on demand and continue parsing. I'd bet my money that something is not stored/restored with the new version of llvm...

Indeed, I found two fields that were not correctly reset: https://github.com/root-project/root/pull/15004 (actually already there with LLVM 13...)

@ktf would be appreciated if you can test this on your side since we don't have a standalone reproducer. The commits should apply cleanly to ROOT 6.30 (only the first one is needed as a "fix")

vgvassilev commented 7 months ago

Nice catch, @hahnjo!

@ktf to be immune to such problems my recommendation has always been to move to C++ modules aware dictionaries on the experiments side. That means running rootcling --cxxmodule plus some more scaffolding but that's workable. If one starts from the root of the build rules it can be done incrementally, library for library.

ktf commented 7 months ago

@hahnjo thank you! I will try it asap. @vgvassilev yeah, I know, I will try to bump that in priority.

github-actions[bot] commented 7 months ago

Hi @hahnjo, @dpiparo,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot:

hahnjo commented 5 months ago

@ktf did you have a chance to test the changes for ALICE? IIRC it's not backported to our v6-30-00-patches branch, but it should apply cleanly for you to test...

ktf commented 5 months ago

Sorry, I dropped the ball on this. I will try to have a look.

hahnjo commented 4 months ago

@ktf any updates on this?

dpiparo commented 4 months ago

Hello, can this issue perhaps be closed, @ktf?

ktf commented 4 months ago

I can confirm that the reproducer is now working correctly (while it still breaks with the old ROOT). Thank you for your support (and patience).

github-actions[bot] commented 4 months ago

Hi @ktf, @dpiparo,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot:

github-actions[bot] commented 4 months ago

Hi @ktf, @dpiparo,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot: