Fix PR86413

Message ID alpine.LSU.2.20.1807061211040.16707@zhemvz.fhfr.qr
State New
Headers show
Series
  • Fix PR86413
Related show

Commit Message

Richard Biener July 6, 2018, 10:14 a.m.
The following fixes

FAIL: gcc.dg/guality/pr48437.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 14 i == 0

because we now prune non-local/VAR_DECLs from BLOCK trees during
free-lang-data (after we emitted early dwarf).  gen_block_die
isn't prepared for that and now refuses to add low/high-PC
attributes to blocks that got all BLOCK_VARS stripped that way.

The fix is to simply always emit them for early generated DIEs
(so we only ever elide the DIE creation during early dwarf).

Note this would allow us to prune BLOCK_VARS completely after
early dwarf generation (but we need to keep the BLOCK tree itself
for scoping obviously).

Bootstrap / regtest running on x86_64-unknown-linux-gnu, ok?

Thanks,
Richard.

2018-07-06  Richard Biener  <rguenther@suse.de>

	PR debug/86413
	* dwarf2out.c (gen_block_die): For an early generated DIE
	always output high/low PC attributes.

Comments

Jason Merrill July 8, 2018, 12:07 p.m. | #1
OK.

On Fri, Jul 6, 2018 at 8:14 PM, Richard Biener <rguenther@suse.de> wrote:
>
> The following fixes
>
> FAIL: gcc.dg/guality/pr48437.c   -O2 -flto -fno-use-linker-plugin
> -flto-partition=none  line 14 i == 0
>
> because we now prune non-local/VAR_DECLs from BLOCK trees during
> free-lang-data (after we emitted early dwarf).  gen_block_die
> isn't prepared for that and now refuses to add low/high-PC
> attributes to blocks that got all BLOCK_VARS stripped that way.
>
> The fix is to simply always emit them for early generated DIEs
> (so we only ever elide the DIE creation during early dwarf).
>
> Note this would allow us to prune BLOCK_VARS completely after
> early dwarf generation (but we need to keep the BLOCK tree itself
> for scoping obviously).
>
> Bootstrap / regtest running on x86_64-unknown-linux-gnu, ok?
>
> Thanks,
> Richard.
>
> 2018-07-06  Richard Biener  <rguenther@suse.de>
>
>         PR debug/86413
>         * dwarf2out.c (gen_block_die): For an early generated DIE
>         always output high/low PC attributes.
>
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index a7c4620cfc3..95232177d83 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -25622,6 +25622,11 @@ gen_block_die (tree stmt, dw_die_ref context_die)
>      /* The outer scopes for inlinings *must* always be represented.  We
>         generate DW_TAG_inlined_subroutine DIEs for them.  (See below.) */
>      must_output_die = 1;
> +  else if (BLOCK_DIE (stmt))
> +    /* If we already have a DIE then it was filled early.  Meanwhile
> +       we might have pruned all BLOCK_VARS as optimized out but we
> +       still want to generate high/low PC attributes so output it.  */
> +    must_output_die = 1;
>    else
>      {
>        /* Determine if this block directly contains any "significant"

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index a7c4620cfc3..95232177d83 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -25622,6 +25622,11 @@  gen_block_die (tree stmt, dw_die_ref context_die)
     /* The outer scopes for inlinings *must* always be represented.  We
        generate DW_TAG_inlined_subroutine DIEs for them.  (See below.) */
     must_output_die = 1;
+  else if (BLOCK_DIE (stmt))
+    /* If we already have a DIE then it was filled early.  Meanwhile
+       we might have pruned all BLOCK_VARS as optimized out but we
+       still want to generate high/low PC attributes so output it.  */
+    must_output_die = 1;
   else
     {
       /* Determine if this block directly contains any "significant"