gdb/testsuite: Remove hard coded addresses from expected results
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-ptype.exp
1 # Copyright 2015-2020 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 standard_testfile "vla.f90"
17 load_lib "fortran.exp"
18
19 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
20 {debug f90 quiet}] } {
21 return -1
22 }
23
24 if ![runto_main] {
25 untested "could not run to main"
26 return -1
27 }
28
29 # Depending on the compiler being used, the type names can be printed differently.
30 set real [fortran_real4]
31
32 # Check the ptype of various VLA states and pointer to VLA's.
33 gdb_breakpoint [gdb_get_line_number "vla1-init"]
34 gdb_continue_to_breakpoint "vla1-init"
35 gdb_test "ptype vla1" "type = $real, allocatable \\(:,:,:\\)" "ptype vla1 not initialized"
36 gdb_test "ptype vla2" "type = $real, allocatable \\(:,:,:\\)" "ptype vla2 not initialized"
37 gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla not initialized"
38 gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
39 "ptype vla1(3, 6, 9) not initialized"
40 gdb_test "ptype vla2(5, 45, 20)" \
41 "no such vector element \\\(vector not allocated\\\)" \
42 "ptype vla2(5, 45, 20) not initialized"
43
44 gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
45 gdb_continue_to_breakpoint "vla1-allocated"
46 gdb_test "ptype vla1" "type = $real, allocatable \\\(10,10,10\\\)" \
47 "ptype vla1 allocated"
48
49 gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
50 gdb_continue_to_breakpoint "vla2-allocated"
51 gdb_test "ptype vla2" "type = $real, allocatable \\\(7,42:50,13:35\\\)" \
52 "ptype vla2 allocated"
53
54 gdb_breakpoint [gdb_get_line_number "vla1-filled"]
55 gdb_continue_to_breakpoint "vla1-filled"
56 gdb_test "ptype vla1" "type = $real, allocatable \\\(10,10,10\\\)" \
57 "ptype vla1 filled"
58 gdb_test "ptype vla1(3, 6, 9)" "type = $real"
59
60 gdb_breakpoint [gdb_get_line_number "vla2-filled"]
61 gdb_continue_to_breakpoint "vla2-filled"
62 gdb_test "ptype vla2" "type = $real, allocatable \\\(7,42:50,13:35\\\)" \
63 "ptype vla2 filled"
64 gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
65 "ptype vla2(5, 45, 20) filled"
66
67 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
68 gdb_continue_to_breakpoint "pvla-associated"
69 gdb_test "ptype pvla" "type = $real \\\(10,10,10\\\)" \
70 "ptype pvla associated"
71 gdb_test "ptype pvla(3, 6, 9)" "type = $real"
72
73 gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
74 gdb_continue_to_breakpoint "pvla-re-associated"
75 gdb_test "ptype pvla" "type = $real \\\(7,42:50,13:35\\\)" \
76 "ptype pvla re-associated"
77 gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
78 "ptype vla2(5, 45, 20) re-associated"
79
80 gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
81 gdb_continue_to_breakpoint "pvla-deassociated"
82 gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla deassociated"
83 gdb_test "ptype pvla(5, 45, 20)" \
84 "no such vector element \\\(vector not associated\\\)" \
85 "ptype pvla(5, 45, 20) not associated"
86
87 gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
88 gdb_continue_to_breakpoint "vla1-deallocated"
89 gdb_test "ptype vla1" "type = $real, allocatable \\(:,:,:\\)" "ptype vla1 not allocated"
90 gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
91 "ptype vla1(3, 6, 9) not allocated"
92
93 gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
94 gdb_continue_to_breakpoint "vla2-deallocated"
95 gdb_test "ptype vla2" "type = $real, allocatable \\(:,:,:\\)" "ptype vla2 not allocated"
96 gdb_test "ptype vla2(5, 45, 20)" \
97 "no such vector element \\\(vector not allocated\\\)" \
98 "ptype vla2(5, 45, 20) not allocated"
99
100 gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"]
101 gdb_continue_to_breakpoint "vla1-neg-bounds-v1"
102 gdb_test "ptype vla1" \
103 "type = $real, allocatable \\(-2:-1,-5:-2,-3:-1\\)" \
104 "ptype vla1 negative bounds"
105
106 gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v2"]
107 gdb_continue_to_breakpoint "vla1-neg-bounds-v2"
108 gdb_test "ptype vla1" \
109 "type = $real, allocatable \\(-2:1,-5:2,-3:1\\)" \
110 "ptype vla1 negative lower bounds, positive upper bounds"
This page took 0.03109 seconds and 4 git commands to generate.