In Ada, it is possible for a scalar type to have a biased representation in some contexts. For instance:
In Record_Type, the A and B fields will be represented on 3 bits each. This is possible because they have a biased representation:
- the 000 bit pattern represents 50;
- the 001 one represents 51;
So in this example, the representation for A and B have a bias of 50. The general principle is that given some type T, a bias B and a value V, the runtime representation for V is:
V - B
There is no way to describe this representation in DWARF today.
One new attribute is proposed to lift this limitation: DW_AT_GNU_bias, whose form is any constant form and which represents an integer (unsigned, unless the form represents a signed one). This attribute can appear on DW_TAG_subrange_type DIEs. The corresponding subrange and only this one must be decoded using the bias.
The bias is not inheritted in subranges that reference this one so that bias processing is consistent with bounds processing (DW_AT_lower_bound, DW_AT_upper_bound).