Fix gdb.ada/packed_array_assign.exp by using more unique names.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 26 Dec 2018 13:19:00 +0000 (14:19 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 27 Dec 2018 09:47:00 +0000 (10:47 +0100)
The test gdb.ada/packed_array_assign fails due to conflict between component 'w'
and system.dim.mks.w:

(gdb) print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))
Unknown component name: system.dim.mks.w.
(gdb) FAIL: gdb.ada/packed_array_assign.exp: print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))

Also, depending on the compiler version, the component w might be reordered
and placed before components x and y.
So, change the component order in the source, so that both an old
compiler (GNATMAKE 6.3.0, gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516)
and a new compiler (GNATMAKE Pro 20.0w (20181210-82), based on gcc 8.2.1)
produce the same component order (checked by using -gnatR3s).

So, update to test the new (more unique) names in the source order.

2018-12-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.ada/packed_array_assign/aggregates.ads (Packed_Rec):
Rename components to Packed_Array_Assign_[X|Y|W].  Place
component Packed_Array_Assign_W as first component, to ensure
old and new compilers have the same representation.
All users updated.

gdb/testsuite/gdb.ada/packed_array_assign.exp
gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads

index 25b20dd..317a156 100644 (file)
@@ -26,5 +26,5 @@ clean_restart ${testfile}
 runto "aggregates.run_test"
 
 gdb_test \
-    "print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))" \
-    " = \\(\\(w => 17, x => 2, y => 0\\), \\(w => 104, x => 2, y => 3\\), \\(w => 23, x => 7, y => 1\\)\\)"
+    "print pra := ((packed_array_assign_x => 2, packed_array_assign_y => 0, packed_array_assign_w => 17), pr, (packed_array_assign_x => 7, packed_array_assign_y => 1, packed_array_assign_w => 23))" \
+    " = \\(\\(packed_array_assign_w => 17, packed_array_assign_x => 2, packed_array_assign_y => 0\\), \\(packed_array_assign_w => 104, packed_array_assign_x => 2, packed_array_assign_y => 3\\), \\(packed_array_assign_w => 23, packed_array_assign_x => 7, packed_array_assign_y => 1\\)\\)"
index b43f70a..2648982 100644 (file)
@@ -17,8 +17,8 @@ package Aggregates is
    subtype Int is Integer range 0 .. 7;
 
    type Packed_Rec is record
-      X, Y : Int;
-      W    : Integer;
+      Packed_Array_Assign_W    : Integer;
+      Packed_Array_Assign_X, Packed_Array_Assign_Y : Int;
    end record;
    pragma Pack (Packed_Rec);
 
@@ -28,6 +28,8 @@ package Aggregates is
    procedure Run_Test;
 
 private
-   PR : Packed_Rec := (y => 3, w => 104, x => 2);
+   PR : Packed_Rec := (Packed_Array_Assign_Y => 3,
+                       Packed_Array_Assign_W => 104,
+                       Packed_Array_Assign_X  => 2);
    PRA : Packed_RecArr (1 .. 3);
 end Aggregates;