The Bit attribute is a GNAT-specific attribute which yields the bit offset within the byte that contains the first bit of storage allocated for the object to which it is applied. However, it was returning 0 for bit-packed array references. The fix is to extend the special handling of bit-packed array references already implemented for the Address attribute. That's quite natural since this pair of attributes can be seen as a (/,mod) pair for addresses. The following program must run quietly: with System; use System; procedure Bit_Attribute is type Bits is array (1..8) of Boolean; pragma Pack (Bits); My_Bits : Bits := (Others => False); pragma Volatile (My_Bits); type Rec is record A : Boolean; B : Bits; end record; pragma Pack (Rec); My_Rec : Rec := (A => False, B => (Others => False)); pragma Volatile (My_Rec); A : Address; N : Natural; begin A := My_Bits(3)'Address; if A /= My_Bits'Address then raise Program_Error; end if; N := My_Bits(3)'Bit; if N /= 2 then raise Program_Error; end if; A := My_Rec.B(3)'Address; if A /= My_Rec'Address then raise Program_Error; end if; N := My_Rec.B(3)'Bit; if N /= 3 then raise Program_Error; end if; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-22 Eric Botcazou * exp_attr.adb (Expand_N_Attribute_Reference) : Deal with packed array references specially. * exp_ch4.adb (Expand_N_Indexed_Component): Do not convert a reference to a component of a bit packed array if it is the prefix of 'Bit. * exp_pakd.ads (Expand_Packed_Bit_Reference): Declare. * exp_pakd.adb (Expand_Packed_Bit_Reference): New procedure. Expand a 'Bit reference, where the prefix involves a packed array reference. (Get_Base_And_Bit_Offset): New helper, extracted from... (Expand_Packed_Address_Reference): ...here. Call above procedure to get the outer object and offset expression.