Hi,

this is a regression present on the mainline and 9 branch: since
  https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01066.html
the debug info emitted in Ada with -fgnat-encodings=minimal for discriminated 
record types containing an array component whose bound is a discriminant is 
incomplete, i.e. the DW_AT_*_bound attribute of the range subtype is missing.

Tested on x86_64-suse-linux, OK for mainline and 9 branch?


2019-07-03  Eric Botcazou  <ebotca...@adacore.com>

        * dwarf2out.c (add_scalar_info): Add back refererence to existing DIE
        if it has the DW_AT_data_member_location attribute.


2019-07-03  Eric Botcazou  <ebotca...@adacore.com>

        * gnat.dg/specs/debug1.ads: New test.
        
-- 
Eric Botcazou
Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 272930)
+++ dwarf2out.c	(working copy)
@@ -20845,6 +20845,7 @@ add_scalar_info (dw_die_ref die, enum dw
 	  if (decl_die != NULL)
 	    {
 	      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))
 		{
 		  add_AT_die_ref (die, attr, decl_die);
-- { dg-do compile }
-- { dg-options "-cargs -g -dA -fgnat-encodings=minimal -margs" }

package Debug1 is

   type Index_T is new Positive range 1 .. 128;

   type Array_Type is array (Index_T range <>) of Integer;

   type Record_Type (N : Index_T := 16) is record
      A : Array_Type (1 .. N);
   end record;

   R : Record_Type;

end Debug1;

--  { dg-final { scan-assembler-times "DW_AT_upper_bound" 4 } }

Reply via email to