llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

llvm::DwarfDebug::NonTypeUnitContext::NonTypeUnitContext(llvm::DwarfDebug *): Assertion `TypeUnitsUnderConstruction.empty() || !DD->AddrPool.hasBeenUsed()' failed.

Open jcai19 opened this issue 6 years ago • 6 comments

Bugzilla Link 44685
Resolution FIXED
Resolved on Dec 17, 2020 17:07
Version trunk
OS Linux
Attachments A reduced code example for reproducing the issue.
CC @dwblaikie,@pogo59,@zygoloid

Extended Description

Chrome failed to build during linking with thinlto on ChromeOS with the following assertion failure

chromeos-chrome-81.0.4001.0_rc-r1: ld.lld: /var/tmp/portage/sys-devel/llvm-10.0_pre370808_p20191029-r6/work/llvm-10.0_pre370808_p20191029/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:2998: llvm::DwarfDebug::NonTypeUnitContext::NonTypeUnitContext(llvm::DwarfDebug *): Assertion `TypeUnitsUnderConstruction.empty() || !DD->AddrPool.hasBeenUsed()' failed.

I've attached a reduced example (repro.cpp). To reproduce, run

$ /path/to/clang++ -c -g -gsplit-dwarf -mllvm -generate-type-units repro.cpp

jcai19 avatar Jan 27 '20 23:01 jcai19

Sorry I just realized I've never confirmed. It fixed the issue on Chrome OS. Thanks!

jcai19 avatar Dec 18 '20 01:12 jcai19

Fixed by be3ef93bf58aa5546c7baadfb21d43b75fbb4e24 hopefully.

dwblaikie avatar Aug 18 '20 04:08 dwblaikie

David, have you had a chance to look at this? If not, I can take a look.

Nah, this hasn't got to the top of my queue yet. More than welcome to have a go :)

Happy to chat (discord, IRC, whatever) if you've questions about how this code is supposed to work, etc.

dwblaikie avatar Mar 16 '20 19:03 dwblaikie

David, have you had a chance to look at this? If not, I can take a look.

llvmbot avatar Mar 05 '20 18:03 llvmbot

Thank you for the clarification!

jcai19 avatar Jan 27 '20 23:01 jcai19

Thanks for the reduced test case!

Doesn't seem to be specific to ThinLTO, as shown in the example you've attached.

I trimmed a little off the test case:

extern int foo;

namespace { template struct wrap { T value; }; }

template <int *> struct S { struct Inner { wrap v; };

Inner i; };

S<&foo> s;

& I'll look into a fix soon.

dwblaikie avatar Jan 27 '20 23:01 dwblaikie