-
Notifications
You must be signed in to change notification settings - Fork 38
Description
While debugging some code I got a compiler crash.
It happens after the compiler finds and diagnoses some issues with my code which was using an undeclared identifier, if I fix that issue I no longer get the crash.
The assertion triggered was
clang-14: /home/ubuntu/opencilkv20/opencilk-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:3613: llvm::PointerUnio
n<Decl *, LocalInstantiationScope::DeclArgumentPack *> *clang::LocalInstantiationScope::findInstantiationOf(const clan
g::Decl *): Assertion `isa(D) && "declaration not instantiated in this scope"' failed
The backtrace is bellow, the requested files are attached. Sorry for the giant test case.
test-6c970e.sh.txt
test-6c970e.cpp.txt
-
<eof> parser at end of file -
./CPMA.hpp:309:8: instantiating function definition 'CPMA<delta_compressed_leaf<unsigned int>, Linear, 0, fals
e>::insert'
3. ./CPMA.hpp:224:8: instantiating function definition 'CPMA<delta_compressed_leaf, Linear, 0, fals
e>::grow_list'
4. ./leaf.hpp:844:3: instantiating function definition 'delta_compressed_leaf::merge<false, false,
(lambda at ./CPMA.hpp:508:11), empty_type>'
5. ./leaf.hpp:718:3: instantiating function definition 'delta_compressed_leaf::parallel_merge<false
, false, (lambda at ./CPMA.hpp:508:11), empty_type>'
#0 0x0000000002005b93 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ubuntu/opencilkv20/build/bin/clang-1
4+0x2005b93)
#1 0x00000000020038be llvm::sys::RunSignalHandlers() (/home/ubuntu/opencilkv20/build/bin/clang-14+0x20038be)
#2 0x000000000200604f SignalHandler(int) Signals.cpp:0:0
#3 0x00007fd03762a3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
#4 0x00007fd03708503b raise /build/glibc-sMfBJT/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fd037064859 abort /build/glibc-sMfBJT/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fd037064729 get_sysdep_segment_value /build/glibc-sMfBJT/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fd037064729 _nl_load_domain /build/glibc-sMfBJT/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fd037076006 (/lib/x86_64-linux-gnu/libc.so.6+0x34006)
#9 0x00000000043890cf clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) (/home/ubuntu/opencilkv
20/build/bin/clang-14+0x43890cf)
#10 0x00000000043bc423 clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*, clang::MultiLevelTe
mplateArgumentList const&, bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43bc423)
#11 0x000000000439c733 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformDeclRefExpr(clang::
DeclRefExpr*) SemaTemplateInstantiate.cpp:0:0
#12 0x000000000438b015 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformBinaryOperator(clan
g::BinaryOperator*) SemaTemplateInstantiate.cpp:0:0
#13 0x0000000004387512 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr*
const*, unsigned int, bool, llvm::SmallVectorImplclang::Expr*&, bool*) SemaTemplateInstantiate.cpp:0:0
#14 0x000000000438f71e clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::Cal
lExpr*) SemaTemplateInstantiate.cpp:0:0
#15 0x0000000004387512 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr*
const*, unsigned int, bool, llvm::SmallVectorImplclang::Expr*&, bool*) SemaTemplateInstantiate.cpp:0:0
#16 0x000000000439629a clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformParenListExpr(clang
::ParenListExpr*) SemaTemplateInstantiate.cpp:0:0
#17 0x0000000004382db6 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool)
(/home/ubuntu/opencilkv20/build/bin/clang-14+0x4382db6)
#18 0x00000000043cbb8f clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevel
TemplateArgumentList const&) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43cbb8f)
#19 0x00000000043bed4b clang::Sema::BuildVariableInstantiation(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemp
lateArgumentList const&, llvm::SmallVector<clang::Sema::LateInstantiatedAttribute, 16u>, clang::DeclContext, clang::
LocalInstantiationScope*, bool, clang::VarTemplateSpecializationDecl*) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x
43bed4b)
#20 0x00000000043be3c9 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool, llvm::ArrayRef<clang::Bind
ingDecl*>) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43be3c9)
#21 0x0000000004402584 void llvm::function_ref<void ()>::callback_fn<clang::Sema::SubstDecl(clang::Decl, clang::DeclC
ontext*, clang::MultiLevelTemplateArgumentList const&)::$_0>(long) SemaTemplateInstantiateDecl.cpp:0:0
#22 0x0000000003ca894b clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/
home/ubuntu/opencilkv20/build/bin/clang-14+0x3ca894b)
#23 0x00000000043cd68f clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList
const&) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43cd68f)
#24 0x00000000043a83da clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformDeclStmt(clang::Dec
lStmt*) SemaTemplateInstantiate.cpp:0:0
#25 0x00000000043a2736 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang:
:CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#26 0x00000000043a8964 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStm
t*) SemaTemplateInstantiate.cpp:0:0
#27 0x00000000043a2736 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang:
:CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#28 0x000000000439e93e clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::L
ambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#29 0x0000000004385ff4 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
SemaTemplateInstantiate.cpp:0:0
#30 0x0000000004387512 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr*
const*, unsigned int, bool, llvm::SmallVectorImplclang::Expr*&, bool*) SemaTemplateInstantiate.cpp:0:0
#31 0x000000000438f71e clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::Cal
lExpr*) SemaTemplateInstantiate.cpp:0:0
#32 0x0000000004384a06 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*,
clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) SemaTemplateInstantiate.cpp:0:0
#33 0x00000000043a2736 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang:
:CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#34 0x000000000438499b clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/home/ubunt
u/opencilkv20/build/bin/clang-14+0x438499b)
#35 0x00000000043cff8b clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, b
ool, bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43cff8b)
#36 0x00000000043d2ffe clang::Sema::PerformPendingInstantiations(bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x
43d2ffe)
#37 0x00000000043d022a clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, b
ool, bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43d022a)
#38 0x00000000043d2ffe clang::Sema::PerformPendingInstantiations(bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x
43d2ffe)
#39 0x00000000043d022a clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, b
ool, bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43d022a)
#40 0x00000000043d2ffe clang::Sema::PerformPendingInstantiations(bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x
43d2ffe)
#41 0x00000000043d022a clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, b
ool, bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x43d022a)
#42 0x00000000043d2ffe clang::Sema::PerformPendingInstantiations(bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x
43d2ffe)
#43 0x0000000003caaa34 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/home/ubuntu/openc
ilkv20/build/bin/clang-14+0x3caaa34)
#44 0x0000000003cab218 clang::Sema::ActOnEndOfTranslationUnit() (/home/ubuntu/opencilkv20/build/bin/clang-14+0x3cab218
)
#45 0x0000000003b828ec clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, bool) (/home/ubuntu/op
encilkv20/build/bin/clang-14+0x3b828ec)
#46 0x0000000003b7d1dd clang::ParseAST(clang::Sema&, bool, bool) (/home/ubuntu/opencilkv20/build/bin/clang-14+0x3b7d1d
d)
#47 0x0000000002a1c380 clang::FrontendAction::Execute() (/home/ubuntu/opencilkv20/build/bin/clang-14+0x2a1c380)
#48 0x000000000299840f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/ubuntu/opencilkv20/build/
bin/clang-14+0x299840f)
#49 0x0000000002ad3933 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/ubuntu/opencilkv20/build/bin/
clang-14+0x2ad3933)
#50 0x00000000009eb097 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/ubuntu/opencilkv20/build/bin/c
lang-14+0x9eb097)
#51 0x00000000009e8da0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#52 0x00000000009e8b34 main (/home/ubuntu/opencilkv20/build/bin/clang-14+0x9e8b34)
#53 0x00007fd0370660b3 __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:342:3
#54 0x00000000009e5c6e _start (/home/ubuntu/opencilkv20/build/bin/clang-14+0x9e5c6e)
clang-14: error: unable to execute command: Aborted (core dumped)
clang-14: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 14.0.5 (https://github.com/OpenCilk/opencilk-project f51b7f1)