Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing Cling test for unloading Lambda in template instantiation #12457

Closed
hahnjo opened this issue Mar 8, 2023 · 1 comment · Fixed by #12853
Closed

Failing Cling test for unloading Lambda in template instantiation #12457

hahnjo opened this issue Mar 8, 2023 · 1 comment · Fixed by #12853

Comments

@hahnjo
Copy link
Member

hahnjo commented Mar 8, 2023

Since the upgrade to LLVM 13, the Cling test CodeUnloading/RereadFile.C fails with

cling: /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/DeclCXX.cpp:1499: clang::NamedDecl *getLambdaCallOperatorHelper(const clang::CXXRecordDecl &): Assertion `!Calls.empty() && "Missing lambda call operator!"' failed.
 #0 0x00000000023cb663 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/jhahnfel/ROOT/src/interpreter/llvm/src/lib/Support/Unix/Signals.inc:565:13
 #1 0x00000000023c9822 llvm::sys::RunSignalHandlers() /home/jhahnfel/ROOT/src/interpreter/llvm/src/lib/Support/Signals.cpp:98:18
 #2 0x00000000023cbc6f SignalHandler(int) /home/jhahnfel/ROOT/src/interpreter/llvm/src/lib/Support/Unix/Signals.inc:407:1
 #3 0x00007fdc3a8d4b50 __restore_rt (/lib64/libc.so.6+0x4eb50)
 #4 0x00007fdc3a8d4acf raise (/lib64/libc.so.6+0x4eacf)
 #5 0x00007fdc3a8a7ea5 abort (/lib64/libc.so.6+0x21ea5)
 #6 0x00007fdc3a8a7d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
 #7 0x00007fdc3a8cd426 (/lib64/libc.so.6+0x47426)
 #8 0x00000000037504a4 (/home/jhahnfel/ROOT/build-cling-clang/interpreter/llvm/src/bin/cling+0x37504a4)
 #9 0x00000000037504b6 clang::CXXRecordDecl::getLambdaCallOperator() const /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/DeclCXX.cpp:1513:14
#10 0x0000000003750559 clang::ValueDecl::getType() const /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/include/clang/AST/Decl.h:687:37
#11 0x0000000003750559 clang::CXXRecordDecl::getLambdaStaticInvoker() const /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/DeclCXX.cpp:1524:28
#12 0x00000000038a67b7 (anonymous namespace)::CXXNameMangler::mangleLambdaSig(clang::CXXRecordDecl const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:1977:3
#13 0x00000000038a59be (anonymous namespace)::CXXNameMangler::mangleLambda(clang::CXXRecordDecl const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:1948:3
#14 0x00000000038a38fc (anonymous namespace)::CXXNameMangler::mangleUnqualifiedName(clang::GlobalDecl, clang::DeclarationName, unsigned int, llvm::SmallVector<llvm::StringRef, 4u> const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:0:9
#15 0x00000000038a916b (anonymous namespace)::CXXNameMangler::mangleUnqualifiedName(clang::GlobalDecl, llvm::SmallVector<llvm::StringRef, 4u> const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:0:5
#16 0x00000000038a916b (anonymous namespace)::CXXNameMangler::mangleLocalName(clang::GlobalDecl, llvm::SmallVector<llvm::StringRef, 4u> const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:1787:7
#17 0x00000000038a8acb (anonymous namespace)::CXXNameMangler::mangleType(clang::TagType const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:3296:1
#18 0x00000000038957ec (anonymous namespace)::CXXNameMangler::mangleType(clang::QualType) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:0:5
#19 0x000000000389490b (anonymous namespace)::CXXNameMangler::makeVariableTypeTags(clang::VarDecl const*) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:6147:40
#20 0x000000000389490b (anonymous namespace)::CXXNameMangler::mangleName(clang::GlobalDecl) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:927:38
#21 0x000000000389179f (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::GlobalDecl, llvm::raw_ostream&) /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/lib/AST/ItaniumMangle.cpp:0:0
#22 0x00000000023221e3 llvm::raw_ostream::flush() /home/jhahnfel/ROOT/src/interpreter/llvm/src/include/llvm/Support/raw_ostream.h:187:9
#23 0x00000000023221e3 cling::utils::Analyze::maybeMangleDeclName(clang::GlobalDecl const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Utils/AST.cpp:102:12
#24 0x000000000225342d llvm::PointerIntPair<clang::Decl const*, 3u, unsigned int, llvm::PointerLikeTypeTraits<clang::Decl const*>, llvm::PointerIntPairInfo<clang::Decl const*, 3u, llvm::PointerLikeTypeTraits<clang::Decl const*>>>::getPointer() const /home/jhahnfel/ROOT/src/interpreter/llvm/src/include/llvm/ADT/PointerIntPair.h:59:58
#25 0x000000000225342d clang::GlobalDecl::getDecl() const /home/jhahnfel/ROOT/src/interpreter/llvm/src/tools/clang/include/clang/AST/GlobalDecl.h:102:46
#26 0x000000000225342d cling::DeclUnloader::MaybeRemoveDeclFromModule(clang::GlobalDecl&) const /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/DeclUnloader.cpp:862:52
#27 0x00000000022532f6 cling::DeclUnloader::VisitVarDecl(clang::VarDecl*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/DeclUnloader.cpp:0:7
#28 0x0000000002253df2 cling::DeclUnloader::VisitDeclContext(clang::DeclContext*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/DeclUnloader.cpp:696:7
#29 0x00000000022539d1 cling::DeclUnloader::VisitFunctionDecl(clang::FunctionDecl*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/DeclUnloader.cpp:549:23
#30 0x0000000002302591 cling::TransactionUnloader::unloadDeclarations(cling::Transaction*, cling::DeclUnloader&) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/TransactionUnloader.cpp:65:9
#31 0x00000000023029b5 cling::TransactionUnloader::RevertTransaction(cling::Transaction*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/TransactionUnloader.cpp:0:18
#32 0x00000000022cc5f6 cling::Interpreter::unload(cling::Transaction&) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/Interpreter.cpp:0:0
#33 0x00000000022cc74f cling::Interpreter::unload(unsigned int) /home/jhahnfel/ROOT/src/interpreter/cling/lib/Interpreter/Interpreter.cpp:1569:28
#34 0x000000000231e9ce cling::MetaSema::actOnUCommand(llvm::StringRef) /home/jhahnfel/ROOT/src/interpreter/cling/lib/MetaProcessor/MetaSema.cpp:216:14
#35 0x000000000231e62b cling::MetaSema::actOnLCommand(llvm::StringRef, cling::Transaction**) /home/jhahnfel/ROOT/src/interpreter/cling/lib/MetaProcessor/MetaSema.cpp:0:9
#36 0x000000000231f147 cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/MetaProcessor/MetaSema.cpp:0:9
#37 0x000000000231a569 cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/MetaProcessor/MetaParser.cpp:315:20
#38 0x0000000002319e27 cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) /home/jhahnfel/ROOT/src/interpreter/cling/lib/MetaProcessor/MetaParser.cpp:119:48
#39 0x000000000231c971 cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) /home/jhahnfel/ROOT/src/interpreter/cling/lib/MetaProcessor/MetaProcessor.cpp:316:9
#40 0x00000000023cedbb cling::UserInterface::runInteractively(bool) /home/jhahnfel/ROOT/src/interpreter/cling/lib/UserInterface/UserInterface.cpp:0:0
#41 0x000000000232e151 main /home/jhahnfel/ROOT/src/interpreter/cling/tools/driver/cling.cpp:138:12
#42 0x00007fdc3a8c0d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#43 0x00000000021b9c0e _start (/home/jhahnfel/ROOT/build-cling-clang/interpreter/llvm/src/bin/cling+0x21b9c0e)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/jhahnfel/ROOT/build-cling-clang/interpreter/llvm/src/bin/cling --nologo -I/home/jhahnfel/ROOT/build-cling-clang/interpreter/llvm/src/tools/clang/include -I/home/jhahnfel/ROOT/src/interpreter/cling/test/CodeUnloading
1.      /home/jhahnfel/ROOT/src/interpreter/cling/test/CodeUnloading/templatedfunc.h:4:8: Mangling declaration 'lambda'

The test was added as part of commit cd9d087. Curiously, the assertion is exactly the same as #9850, but to the uneducated eye it looks to be a different reason (and the fix is definitely still present).

jalopezg-git added a commit to jalopezg-git/root that referenced this issue May 19, 2023
The order in which declarations are removed makes a difference, e.g.
`MaybeRemoveDeclFromModule()` may require access to type information to
make up the mangled name.

Thus, we segregate declarations to be removed in `TagDecl`s (i.e., struct
/ union / class / enum) and other declarations.  Removal of `TagDecl`s
is deferred until all the other declarations have been processed.
Declarations in each group are iterated in reverse order.

Fixes root-project#12457.
jalopezg-git added a commit to jalopezg-git/root that referenced this issue May 19, 2023
The order in which declarations are removed makes a difference, e.g.
`MaybeRemoveDeclFromModule()` may require access to type information to
make up the mangled name.

Thus, we segregate declarations to be removed in `TagDecl`s (i.e., struct
/ union / class / enum) and other declarations.  Removal of `TagDecl`s
is deferred until all the other declarations have been processed.
Declarations in each group are iterated in reverse order.

Fixes root-project#12457.
jalopezg-git added a commit that referenced this issue May 19, 2023
The order in which declarations are removed makes a difference, e.g.
`MaybeRemoveDeclFromModule()` may require access to type information to
make up the mangled name.

Thus, we segregate declarations to be removed in `TagDecl`s (i.e., struct
/ union / class / enum) and other declarations.  Removal of `TagDecl`s
is deferred until all the other declarations have been processed.
Declarations in each group are iterated in reverse order.

Fixes #12457.
jalopezg-git added a commit that referenced this issue May 19, 2023
The order in which declarations are removed makes a difference, e.g.
`MaybeRemoveDeclFromModule()` may require access to type information to
make up the mangled name.

Thus, we segregate declarations to be removed in `TagDecl`s (i.e., struct
/ union / class / enum) and other declarations.  Removal of `TagDecl`s
is deferred until all the other declarations have been processed.
Declarations in each group are iterated in reverse order.

Fixes #12457.
@github-actions
Copy link

Hi @jalopezg-git,

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,
🤖

enirolf pushed a commit to enirolf/root that referenced this issue May 26, 2023
The order in which declarations are removed makes a difference, e.g.
`MaybeRemoveDeclFromModule()` may require access to type information to
make up the mangled name.

Thus, we segregate declarations to be removed in `TagDecl`s (i.e., struct
/ union / class / enum) and other declarations.  Removal of `TagDecl`s
is deferred until all the other declarations have been processed.
Declarations in each group are iterated in reverse order.

Fixes root-project#12457.
maksgraczyk pushed a commit to maksgraczyk/root that referenced this issue Jun 28, 2023
The order in which declarations are removed makes a difference, e.g.
`MaybeRemoveDeclFromModule()` may require access to type information to
make up the mangled name.

Thus, we segregate declarations to be removed in `TagDecl`s (i.e., struct
/ union / class / enum) and other declarations.  Removal of `TagDecl`s
is deferred until all the other declarations have been processed.
Declarations in each group are iterated in reverse order.

Fixes root-project#12457.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants