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

Assertion `CountVarDIE && "DIE for count is not yet instantiated"' failed. #35611

Closed
dstenb mannequin opened this issue Feb 7, 2018 · 4 comments
Closed

Assertion `CountVarDIE && "DIE for count is not yet instantiated"' failed. #35611

dstenb mannequin opened this issue Feb 7, 2018 · 4 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla

Comments

@dstenb
Copy link
Mannequin

dstenb mannequin commented Feb 7, 2018

Bugzilla Link 36263
Resolution FIXED
Resolved on Feb 19, 2018 02:03
Version trunk
OS Linux
Attachments IR reproducer., Original C file.
CC @sdesmalen-arm,@vsapsai

Extended Description

Seen on trunk (rL324422).

When compiling the attached IR file using:

llc -O0 -filetype=asm -mtriple x86_64-unknown-linux-gnu -mcpu=x86-64 -o ./foo.s ./foo.opt.ll

the following crash is seen:

llc: ../lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1355: void llvm::DwarfUnit::constructSubrangeDIE(llvm::DIE &, const llvm::DISubrange , llvm::DIE ): Assertion `CountVarDIE && "DIE for count is not yet instantiated"' failed.
#​0 0x0000000001d744f4 PrintStackTraceSignalHandler(void
) (/repo/llvm/build-all-clang40/bin/llc+0x1d744f4)
#​1 0x0000000001d74836 SignalHandler(int) (/repo/llvm/build-all-clang40/bin/llc+0x1d74836)
#​2 0x00007fdfdb120850 __restore_rt (/lib64/libpthread.so.0+0xf850)
#​3 0x00007fdfda2cb875 __GI_raise (/lib64/libc.so.6+0x32875)
#​4 0x00007fdfda2cce51 __GI_abort (/lib64/libc.so.6+0x33e51)
#​5 0x00007fdfda2c4740 __GI___assert_fail (/lib64/libc.so.6+0x2b740)
#​6 0x00000000013e7249 (/repo/llvm/build-all-clang40/bin/llc+0x13e7249)
#​7 0x00000000013e53d1 llvm::DwarfUnit::constructArrayTypeDIE(llvm::DIE&, llvm::DICompositeType const
) (/repo/llvm/build-all-clang40/bin/llc+0x13e53d1)
#​8 0x00000000013e4400 llvm::DwarfUnit::constructTypeDIE(llvm::DIE&, llvm::DICompositeType const*) (/repo/llvm/build-all-clang40/bin/llc+0x13e4400)
#​9 0x00000000013e345d llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*) (/repo/llvm/build-all-clang40/bin/llc+0x13e345d)
#​10 0x00000000013e312c llvm::DwarfUnit::addType(llvm::DIE&, llvm::DIType const*, llvm::dwarf::Attribute) (/repo/llvm/build-all-clang40/bin/llc+0x13e312c)
#​11 0x0000000001414d71 llvm::DwarfCompileUnit::applyVariableAttributes(llvm::DbgVariable const&, llvm::DIE&) (/repo/llvm/build-all-clang40/bin/llc+0x1414d71)
#​12 0x0000000001414758 llvm::DwarfCompileUnit::constructVariableDIEImpl(llvm::DbgVariable const&, bool) (/repo/llvm/build-all-clang40/bin/llc+0x1414758)
#​13 0x0000000001413a97 llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&, bool*) (/repo/llvm/build-all-clang40/bin/llc+0x1413a97)
#​14 0x000000000141337a llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&) (/repo/llvm/build-all-clang40/bin/llc+0x141337a)
#​15 0x0000000001413c9e llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&, bool*) (/repo/llvm/build-all-clang40/bin/llc+0x1413c9e)
#​16 0x000000000141337a llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&) (/repo/llvm/build-all-clang40/bin/llc+0x141337a)
#​17 0x0000000001413c9e llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&, bool*) (/repo/llvm/build-all-clang40/bin/llc+0x1413c9e)
#​18 0x000000000141337a llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&) (/repo/llvm/build-all-clang40/bin/llc+0x141337a)
#​19 0x0000000001413c9e llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*, llvm::SmallVectorImplllvm::DIE*&, bool*) (/repo/llvm/build-all-clang40/bin/llc+0x1413c9e)
#​20 0x0000000001415ce7 llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE(llvm::LexicalScope*) (/repo/llvm/build-all-clang40/bin/llc+0x1415ce7)

The IR file was generated by running the following commands on the attached C file:

clang -mllvm -disable-llvm-optzns -S -emit-llvm --target=x86_64-unknown-linux-gnu -g foo.c -o ./foo.ll
opt -mcpu=x86-64 -always-inline -O1 -S -o ./foo.opt.ll ./foo.ll

I'm not very knowledgeable about LLVM's inner working for this, but I noted
that the vla_expr variable is not included in the list of local variables for
the scope when running createScopeChildrenDIE(), whereas it is that in the
input IR file:

!​21 = distinct !DILexicalBlock(scope: !​18, file: !​1, line: 5, column: 31)
!​22 = !DILocalVariable(name: "vla_expr", scope: !​21, file: !​1, line: 6, type: !​23)
!​25 = !DILocalVariable(name: "vn", scope: !​21, file: !​1, line: 6, type: !​26)
!​26 = !DICompositeType(tag: DW_TAG_array_type, baseType: !​10, elements: !​27)
!​27 = !{#28}
!​28 = !DISubrange(count: !​22)

@dstenb
Copy link
Mannequin Author

dstenb mannequin commented Feb 7, 2018

assigned to @sdesmalen-arm

@vsapsai
Copy link
Collaborator

vsapsai commented Feb 9, 2018

Please validate with TOT. r324412 and r324677 should have fixed the issue.

@dstenb
Copy link
Mannequin Author

dstenb mannequin commented Feb 13, 2018

Please validate with TOT. r324412 and r324677 should have fixed the issue.

Thanks for the suggestion. Unfortunately, this is still seen on TOT.

With those commits, the list of local variables are sorted in DwarfCompileUnit::createScopeChildrenDIE; however, in this case the vla_expr variable is not included in that list (for some reason).

@sdesmalen-arm
Copy link
Collaborator

This issue is fixed by https://reviews.llvm.org/rL325438 and https://reviews.llvm.org/rL325427.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants