
In Ada you can embed VLAs in local record types and thus end up with dynamic offsets in record types, which are not well described in DWARF because 1) the temporaries generated for them by the gimplifier are naturally marked DECL_IGNORED_P and 2) when the types are referenced in nested subprograms, the DWARF back-end does not correctly handle the rewritten references. gcc/ * dwarf2out.c (loc_list_from_tree_1) <DECL>: During early DWARF, do not expand the VALUE_EXPR of variables put in the non-local frame. * gimplify.c (gimplify_type_sizes) <RECORD_TYPE>: If the type is not to be ignored for debug info, ensure its variable offsets are not. gcc/testsuite/ * gnat.dg/debug8.adb: Minor tweak. * gnat.dg/debug11.adb: Likewise. * gnat.dg/debug16.adb: Likewise. * gnat.dg/debug17.adb: New test. * gnat.dg/specs/debug1.ads: Minor tweak.
27 lines
643 B
Ada
27 lines
643 B
Ada
-- { dg-do compile }
|
|
-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
|
|
-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
|
|
|
|
procedure Debug16 is
|
|
|
|
type Number_T (Exists : Boolean := False) is
|
|
record
|
|
case Exists is
|
|
when True =>
|
|
Value : Natural range 0 .. 255;
|
|
when False =>
|
|
null;
|
|
end case;
|
|
end record;
|
|
pragma Pack (Number_T);
|
|
|
|
X : Number_T;
|
|
|
|
begin
|
|
X := (Exists => True, Value => 10);
|
|
if X.Exists then -- STOP
|
|
X.Value := X.Value + 1;
|
|
end if;
|
|
end;
|
|
|
|
-- { dg-final { scan-assembler-times "DW_AT_discr" 4 } }
|