]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.ada/packed_array_assign.exp
1ccade7dbaa7ceca112bf7a8dc4a4cd70ca9b047
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / packed_array_assign.exp
1 # Copyright 2018-2023 Free Software Foundation, Inc.
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 load_lib "ada.exp"
17
18 require allow_ada_tests
19
20 standard_ada_testfile tester
21
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
23 return -1
24 }
25
26 clean_restart ${testfile}
27
28 runto "aggregates.run_test"
29
30 set kfail_int128support_re \
31 "That operation is not available on integers of more than 8 bytes\\."
32
33 set cmd \
34 [list \
35 "print pra := " \
36 "((packed_array_assign_x => 2," \
37 "packed_array_assign_y => 0," \
38 "packed_array_assign_w => 17)," \
39 "pr," \
40 "(packed_array_assign_x => 7," \
41 "packed_array_assign_y => 1," \
42 "packed_array_assign_w => 23))"]
43 set cmd [join $cmd]
44 set re \
45 [list \
46 " = \\(\\(packed_array_assign_w => 17," \
47 "packed_array_assign_x => 2," \
48 "packed_array_assign_y => 0\\)," \
49 "\\(packed_array_assign_w => 104," \
50 "packed_array_assign_x => 2," \
51 "packed_array_assign_y => 3\\)," \
52 "\\(packed_array_assign_w => 23," \
53 "packed_array_assign_x => 7," \
54 "packed_array_assign_y => 1\\)\\)"]
55
56 # GNAT >= 12.0 has the needed fix here.
57 set zeros_expected [expr {![test_compiler_info {gcc-1[2-9]-*}]}]
58 set all_zeros \
59 [string_to_regexp "((packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0))"]
60
61 set re [join $re]
62 gdb_test_multiple $cmd "value of pra" {
63 -re -wrap $re {
64 pass $gdb_test_name
65 }
66 -re -wrap $kfail_int128support_re {
67 kfail gdb/20991 $gdb_test_name
68 }
69 -re -wrap $all_zeros {
70 if {$zeros_expected} {
71 setup_kfail "GCC 12 needed" *-*-*
72 }
73 fail $gdb_test_name
74 }
75 }
76
77 set cmd "print pra(1) := pr"
78 set re \
79 [list \
80 " = \\(packed_array_assign_w => 104," \
81 "packed_array_assign_x => 2," \
82 "packed_array_assign_y => 3\\)"]
83 set re [join $re]
84 gdb_test_multiple $cmd "" {
85 -re -wrap $re {
86 pass $gdb_test_name
87 }
88 -re -wrap $kfail_int128support_re {
89 kfail gdb/20991 $gdb_test_name
90 }
91 }
92
93 set cmd "print pra(1)"
94 set re \
95 [list \
96 " = \\(packed_array_assign_w => 104," \
97 "packed_array_assign_x => 2," \
98 "packed_array_assign_y => 3\\)"]
99 set re [join $re]
100 gdb_test_multiple $cmd "" {
101 -re -wrap $re {
102 pass $gdb_test_name
103 }
104 -re -wrap $kfail_int128support_re {
105 kfail gdb/20991 $gdb_test_name
106 }
107 }
108
109 gdb_test "print npr := (q000 => 3, r000 => (packed_array_assign_x => 6, packed_array_assign_y => 1, packed_array_assign_w => 117))" \
110 " = \\(q000 => 3, r000 => \\(packed_array_assign_w => 117, packed_array_assign_x => 6, packed_array_assign_y => 1\\)\\)" \
111 "value of npr"