On Thu, Oct 8, 2026 at 12:33 PM Eric Botcazou <[email protected]> wrote: > > Hi, > > This works around a limitation of the DWARF description, which requires the > DW_AT_discr attribute of a DW_TAG_variant_part DIE to be the reference to a > DW_TAG_member DIE of the same record type. Now, for a derived discriminated > tagged record type in Ada, the discriminant may be a component of the _Parent > component, in other words a sub-component of the record type. > > Tested on x86-64/Linux, OK for the mainline?
OK. I wonder if we can have some test coverage here, like check that we now create discriminant information? Thanks, Richard. > > > 2026-10-08 Eric Botcazou <[email protected]> > > * dwarf2out.cc (gen_field_die): Change return type to DW_DIE_REF > and add ANONYMOUS parameter. Adjust implementation accordingly. > (analyze_discr_in_predicate): Rename into... > (extract_discr_in_expr): ...this. Also return a sub-field of the > record type when the containing fields are at offset 0. > (analyze_variants_discr): Adjust to above renaming. > (gen_variant_part): If there is no DIE for the discriminant, create > an anonymous DIE for it in the non-variant part of the record type. > > -- > Eric Botcazou
