2019-05-01 Tom Tromey <tromey@adacore.com>
+ * ada-lang.c (ada_value_primitive_field): Treat more fields as
+ bitfields.
+
+2019-05-01 Tom Tromey <tromey@adacore.com>
+
* ada-lang.c (ada_value_assign): Correctly compute starting offset
for big-endian copies.
arg_type = ada_check_typedef (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
- /* Handle packed fields. */
-
- if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0)
+ /* Handle packed fields. It might be that the field is not packed
+ relative to its containing structure, but the structure itself is
+ packed; in this case we must take the bit-field path. */
+ if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0 || value_bitpos (arg1) != 0)
{
int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
2019-05-01 Tom Tromey <tromey@adacore.com>
+ * gdb.ada/packed_array_assign/aggregates.ads (Nested_Packed): New
+ record.
+ (NPR): New variable.
+ * gdb.ada/packed_array_assign.exp: Add nested packed assignment
+ test.
+
+2019-05-01 Tom Tromey <tromey@adacore.com>
+
* gdb.ada/packed_array_assign.exp: Add packed assignment
regression test.
" = \\(packed_array_assign_w => 104, packed_array_assign_x => 2, packed_array_assign_y => 3\\)"
gdb_test "print pra(1)" \
" = \\(packed_array_assign_w => 104, packed_array_assign_x => 2, packed_array_assign_y => 3\\)"
+
+gdb_test "print npr := (q000 => 3, r000 => (packed_array_assign_x => 6, packed_array_assign_y => 1, packed_array_assign_w => 117))" \
+ " = \\(q000 => 3, r000 => \\(packed_array_assign_w => 117, packed_array_assign_x => 6, packed_array_assign_y => 1\\)\\)"
type Packed_RecArr is array (Integer range <>) of Packed_Rec;
pragma Pack (Packed_RecArr);
+ type Nested_Packed is record
+ Q000 : Int;
+ R000 : Packed_Rec;
+ end record;
+ pragma Pack (Nested_Packed);
+
procedure Run_Test;
private
Packed_Array_Assign_W => 104,
Packed_Array_Assign_X => 2);
PRA : Packed_RecArr (1 .. 3);
+ NPR : Nested_Packed := (q000 => 3, r000 => (packed_array_assign_x => 6, packed_array_assign_y => 1, packed_array_assign_w => 117));
end Aggregates;