Consider the appended Ada program. Here, the offset of "Another_Field" is a non-constant number of bits from the start of the object.
I think there is no way to represent this in DWARF 5. Section 5.7.6, page 119 says: For a DW_AT_data_bit_offset attribute, the value is an integer constant (see Section 2.19 on page 55) that specifies the number of bits from the beginning of the containing entity to the beginning of the data member. This value must be greater than or equal to zero, but is not limited to less than the number of bits per byte. GNAT works around this using the deprecated-in-DWARF-4 DW_AT_bit_offset in conjunction with DW_AT_data_member_location. (You need a patch to GNAT to see this in action.) One way to fix this would be to lift the "integer constant" restriction and allow an expression here. thanks, Tom procedure Exam is type Small is range -7 .. -4; for Small'Size use 2; type Packed_Array is array (Integer range <>) of Small; pragma pack (Packed_Array); subtype Range_Int is Natural range 0 .. 7; type Some_Packed_Record (Discr : Range_Int := 3) is record Array_Field : Packed_Array (1 .. Discr); Field: Small; case Discr is when 3 => Another_Field : Small; when others => null; end case; end record; pragma Pack (Some_Packed_Record); pragma No_Component_Reordering (Some_Packed_Record); SPR : Some_Packed_Record := (Discr => 3, Field => -4, Another_Field => -6, Array_Field => (-5, -6, -7)); begin null; end Exam; -- Dwarf-discuss mailing list Dwarf-discuss@lists.dwarfstd.org https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss