On Sat, May 1, 2021 at 9:04 PM Eric Botcazou <botca...@adacore.com> wrote: > > Hi, > > in Ada you can embed VLAs in local record types and thus end up with dynamic > offsets in record types, which are currently not well described in DWARF > because 1) the temporaries generated for them by the gimplifier are naturally > DECL_IGNORED_P and 2) when the types are referenced in nested subprograms, > the DWARF back-end does not correctly handle the rewritten references. > > The attached patch fixes 1) by reusing the trick already used for VLAs and > 2) by deferring the resolution of these references to the late DWARF pass. > > Tested on x86-64/Linux, both GCC and GDB, OK for the mainline?
OK. I suppose there's no easy way to build a gnat.dg "guality" testcase for this? Thanks, Richard. > > 2021-05-01 Eric Botcazou <ebotca...@adacore.com> > > * 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 either. > > -- > Eric Botcazou