On Wed, Mar 01, 2023 at 01:07:02PM +0000, Richard Biener wrote:
> When combining -g1 with -flto we run into the DIE location annotation
> machinery for globals calling dwarf2out_late_global_decl but not
> having any early generated DIE for function scope statics.  In
> this process we'd generate a limbo DIE since also the function scope
> doesn't have any early generated DIE.  The limbo handling then tries
> to force a DIE for the context chain which ultimatively fails and
> ICEs at the std namespace decl because at -g1 we don't represent that.
> 
> The following avoids this situation by making sure to never generate
> any limbo DIEs from dwarf2out_late_global_decl in the in_lto_p path
> but instead for function scope globals rely on DIE generation for
> the function to output a DIE for the local static (which doesn't
> happen for -g1).
> 
> I explored a lot of other options to fix this but in the end this
> seems to be the most spot-on fix with the least risk of unwanted
> effects.
> 
> LTO bootstrapped on x86_64-unknown-linux-gnu (running into PR108984),
> bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> OK?
> 
> Thanks,
> Richard.
> 
>       PR debug/108772
>       * dwarf2out.cc (dwarf2out_late_global_decl): Do not
>       generate a DIE for a function scope static when we do
>       not have a DIE for the function already.
> 
>       * g++.dg/lto/pr108772_0.C: New testcase.

LGTM, but please give Jason a day to chime in if he disagrees.

        Jakub

Reply via email to