> 2018-08-17 Tom de Vries <tdevr...@suse.de>
>
> * dwarf2out.c (add_scalar_info): Don't add reference to existing die
> unless the referenced die describes the added property using
> DW_AT_location or DW_AT_const_value. Fall back to exprloc case.
> Otherwise, add a DW_AT_location to the referenced die.
This breaks Ada though, i.e. any array type whose bound depends on a
discriminant is affected:
type Array_Type is array (Integer range <>) of Integer;
type Record_Type (N : Integer) is record
A : Array_Type (1 .. N);
end record;
.uleb128 0x6 # (DIE (0x66) DW_TAG_array_type)
.long .LASF5 # DW_AT_name: "p__record_type__T4s"
.long 0x34 # DW_AT_type
.long 0x79 # DW_AT_sibling
.uleb128 0x7 # (DIE (0x73) DW_TAG_subrange_type)
.long 0x2d # DW_AT_type
.byte 0 # end of children of DIE 0x66
Testcase attached, compile with -fgnat-encodings=minimal.
--
Eric Botcazou
package P is
type Array_Type is array (Integer range <>) of Integer;
type Record_Type (N : Integer := 16) is record
A : Array_Type (1 .. N);
end record;
R : Record_Type;
end P;