Fix PR82144

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

Commit Message

Richard Biener Sept. 12, 2017, 1:46 p.m.
The following avoids adding DW_AT_alignment twice by not doing it
for incomplete types.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Alex, is that ok or do we want DW_AT_alignment for incomplete types as 
well?

Thanks,
Richard.

2017-09-12  Richard Biener  <rguenther@suse.de>

	PR middle-end/82144
	* dwarf2out.c (gen_enumeration_type_die): Do not add alignment
	attribute for incomplete types nor twice for complete ones.

Comments

Richard Biener Sept. 21, 2017, 12:17 p.m. | #1
On Tue, 12 Sep 2017, Richard Biener wrote:

> 
> The following avoids adding DW_AT_alignment twice by not doing it
> for incomplete types.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> Alex, is that ok or do we want DW_AT_alignment for incomplete types as 
> well?

Alex, ping?

Thanks,
Richard.

> 2017-09-12  Richard Biener  <rguenther@suse.de>
> 
> 	PR middle-end/82144
> 	* dwarf2out.c (gen_enumeration_type_die): Do not add alignment
> 	attribute for incomplete types nor twice for complete ones.
> 
> Index: gcc/dwarf2out.c
> ===================================================================
> --- gcc/dwarf2out.c	(revision 252002)
> +++ gcc/dwarf2out.c	(working copy)
> @@ -21258,8 +21258,6 @@ gen_enumeration_type_die (tree type, dw_
>    else
>      add_AT_flag (type_die, DW_AT_declaration, 1);
>  
> -  add_alignment_attribute (type_die, type);
> -
>    add_pubtype (type, type_die);
>  
>    return type_die;
Alexandre Oliva Sept. 22, 2017, 8:37 p.m. | #2
On Sep 21, 2017, Richard Biener <rguenther@suse.de> wrote:

> On Tue, 12 Sep 2017, Richard Biener wrote:
>> 
>> The following avoids adding DW_AT_alignment twice by not doing it
>> for incomplete types.
>> 
>> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>> 
>> Alex, is that ok or do we want DW_AT_alignment for incomplete types as 
>> well?

> Alex, ping?

Sorry, still catching up after Cauldron and recovery from the bug I
caught at the conference ;-)

Since incomplete enum types are non-standard, there's no standard to
guide us.  Pointers (the primary viable use of such types) generally
benefit from alignment information, but I don't see how the alignment
could be meaningfully determined for such types.  For debug information,
we're probably better off leaving any tentative or uninitialized
alignment information out of the DIE, so the patch looks good to me.
Thanks for your patience!

Reviewed-by: Alexandre Oliva <aoliva@redhat.com>

>> PR middle-end/82144
>> * dwarf2out.c (gen_enumeration_type_die): Do not add alignment
>> attribute for incomplete types nor twice for complete ones.
Richard Biener Sept. 25, 2017, 7:25 a.m. | #3
On Fri, 22 Sep 2017, Alexandre Oliva wrote:

> On Sep 21, 2017, Richard Biener <rguenther@suse.de> wrote:
> 
> > On Tue, 12 Sep 2017, Richard Biener wrote:
> >> 
> >> The following avoids adding DW_AT_alignment twice by not doing it
> >> for incomplete types.
> >> 
> >> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> >> 
> >> Alex, is that ok or do we want DW_AT_alignment for incomplete types as 
> >> well?
> 
> > Alex, ping?
> 
> Sorry, still catching up after Cauldron and recovery from the bug I
> caught at the conference ;-)
> 
> Since incomplete enum types are non-standard, there's no standard to
> guide us.  Pointers (the primary viable use of such types) generally
> benefit from alignment information, but I don't see how the alignment
> could be meaningfully determined for such types.  For debug information,
> we're probably better off leaving any tentative or uninitialized
> alignment information out of the DIE, so the patch looks good to me.
> Thanks for your patience!

Thanks, applied as rev. 253134.

Richard.

> Reviewed-by: Alexandre Oliva <aoliva@redhat.com>
> 
> >> PR middle-end/82144
> >> * dwarf2out.c (gen_enumeration_type_die): Do not add alignment
> >> attribute for incomplete types nor twice for complete ones.
> 
>

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 252002)
+++ gcc/dwarf2out.c	(working copy)
@@ -21258,8 +21258,6 @@  gen_enumeration_type_die (tree type, dw_
   else
     add_AT_flag (type_die, DW_AT_declaration, 1);
 
-  add_alignment_attribute (type_die, type);
-
   add_pubtype (type, type_die);
 
   return type_die;