https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94469
--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Richard Biener from comment #7) > (In reply to Richard Biener from comment #6) > > Btw, I still wonder how it works with abstract functions, inline and > > concrete instances. Works in gdb, that is - will dig into it a bit after > > lunch. > > So here I see us (without LTO) putting DW_AT_location attributes on the > abstract instance copy. That kind-of makes it not abstract anymore, no? > But that way we avoid emitting multiple DIEs for local statics. With > -flto the same problem appears there because we cannot annotate the > early CUs DIE with a location so the concrete instance copy > gets [generated and] the location. > > So while I intended to have the early CUs behave like fully abstract > the actual DWARF is different. I understand that if I emit the early CU as > partial unit it becomes abstract? Well, that's my theory. I've created a minimal dwarf assembler variant corresponding to the C test-case (with only var aaa), and I could reproduce the problem, however after changing the tag to DW_TAG_partial_unit still a symbol table for that partial unit was created. It seems that the inter-cu ref handling code is responsible for that. I'll try to fix this. > Note we do emit DW_AT_const_value > to early optimized out decls - would those still be found when the early CU > is partial [and not imported anywhere]? I think so, but I could check with the dwarf assembler test-case.