[PATCH] DWARF: Fix missing component in variant part of derived type
Eric Botcazou
botcazou@adacore.com
Thu Oct 8 10:31:53 GMT 2026
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?
2026-10-08 Eric Botcazou <ebotcazou@adacore.com>
* 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 7073 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20261008/8c1c5b41/attachment-0001.bin>
More information about the Gcc-patches
mailing list