diff mbox series

Fix regression in debug info for Ada with DWARF 5

Message ID 1867427.PYKUYFuaPT@arcturus
State New
Headers show
Series Fix regression in debug info for Ada with DWARF 5 | expand

Commit Message

Eric Botcazou Aug. 16, 2021, 10:25 a.m. UTC
Hi,

add_scalar_info can directly generate a reference to an existing DIE for a 
scalar attribute, e.g the upper bound of a VLA, but it does so only if this 
existing DIE has a location or is a constant:

 	      if (get_AT (decl_die, DW_AT_location)
 		  || get_AT (decl_die, DW_AT_data_member_location)
 		  || get_AT (decl_die, DW_AT_const_value))

Now, in DWARF 5, members of a structure that are bitfields no longer have a 
DW_AT_data_member_location but a DW_AT_data_bit_offset attribute instead, so 
the condition is bypassed.

Tested on x86-64/Linux, OK for mainline and 11 branch?


2021-08-16  Eric Botcazou  <ebotcazou@adacore.com>

	* dwarf2out.c (add_scalar_info): Deal with DW_AT_data_bit_offset.

Comments

Richard Biener Aug. 16, 2021, 12:25 p.m. UTC | #1
On Mon, Aug 16, 2021 at 12:25 PM Eric Botcazou <botcazou@adacore.com> wrote:
>
> Hi,
>
> add_scalar_info can directly generate a reference to an existing DIE for a
> scalar attribute, e.g the upper bound of a VLA, but it does so only if this
> existing DIE has a location or is a constant:
>
>               if (get_AT (decl_die, DW_AT_location)
>                   || get_AT (decl_die, DW_AT_data_member_location)
>                   || get_AT (decl_die, DW_AT_const_value))
>
> Now, in DWARF 5, members of a structure that are bitfields no longer have a
> DW_AT_data_member_location but a DW_AT_data_bit_offset attribute instead, so
> the condition is bypassed.
>
> Tested on x86-64/Linux, OK for mainline and 11 branch?

OK

>
> 2021-08-16  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * dwarf2out.c (add_scalar_info): Deal with DW_AT_data_bit_offset.
>
> --
> Eric Botcazou
diff mbox series

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4bcd3313fee..ba0a6d6ed60 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -21253,6 +21253,7 @@  add_scalar_info (dw_die_ref die, enum dwarf_attribute attr, tree value,
 	    {
 	      if (get_AT (decl_die, DW_AT_location)
 		  || get_AT (decl_die, DW_AT_data_member_location)
+		  || get_AT (decl_die, DW_AT_data_bit_offset)
 		  || get_AT (decl_die, DW_AT_const_value))
 		{
 		  add_AT_die_ref (die, attr, decl_die);