]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2015-2023 Free Software Foundation, Inc. |
3f2f83dd KB |
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" | |
0c13f7e5 | 17 | load_lib "fortran.exp" |
3f2f83dd | 18 | |
a54a7f13 PA |
19 | if {[skip_fortran_tests]} { return -1 } |
20 | ||
5b362f04 | 21 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ |
3f2f83dd KB |
22 | {debug f90 quiet}] } { |
23 | return -1 | |
24 | } | |
25 | ||
86cd6bc8 | 26 | if ![fortran_runto_main] { |
3f2f83dd KB |
27 | return -1 |
28 | } | |
29 | ||
0c13f7e5 BH |
30 | # Depending on the compiler being used, the type names can be printed differently. |
31 | set real [fortran_real4] | |
32 | ||
3f2f83dd KB |
33 | # Check the ptype of various VLA states and pointer to VLA's. |
34 | gdb_breakpoint [gdb_get_line_number "vla1-init"] | |
35 | gdb_continue_to_breakpoint "vla1-init" | |
584a927c AB |
36 | gdb_test "ptype vla1" "type = $real, allocatable \\(:,:,:\\)" "ptype vla1 not initialized" |
37 | gdb_test "ptype vla2" "type = $real, allocatable \\(:,:,:\\)" "ptype vla2 not initialized" | |
38 | gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla not initialized" | |
3f2f83dd KB |
39 | gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \ |
40 | "ptype vla1(3, 6, 9) not initialized" | |
41 | gdb_test "ptype vla2(5, 45, 20)" \ | |
42 | "no such vector element \\\(vector not allocated\\\)" \ | |
e0f86435 | 43 | "ptype vla2(5, 45, 20) not initialized" |
3f2f83dd KB |
44 | |
45 | gdb_breakpoint [gdb_get_line_number "vla1-allocated"] | |
46 | gdb_continue_to_breakpoint "vla1-allocated" | |
bc68014d | 47 | gdb_test "ptype vla1" "type = $real, allocatable \\\(10,10,10\\\)" \ |
3f2f83dd KB |
48 | "ptype vla1 allocated" |
49 | ||
50 | gdb_breakpoint [gdb_get_line_number "vla2-allocated"] | |
51 | gdb_continue_to_breakpoint "vla2-allocated" | |
bc68014d | 52 | gdb_test "ptype vla2" "type = $real, allocatable \\\(7,42:50,13:35\\\)" \ |
3f2f83dd KB |
53 | "ptype vla2 allocated" |
54 | ||
55 | gdb_breakpoint [gdb_get_line_number "vla1-filled"] | |
56 | gdb_continue_to_breakpoint "vla1-filled" | |
bc68014d | 57 | gdb_test "ptype vla1" "type = $real, allocatable \\\(10,10,10\\\)" \ |
3f2f83dd | 58 | "ptype vla1 filled" |
d1e36019 | 59 | gdb_test "ptype vla1(3, 6, 9)" "type = $real" |
3f2f83dd KB |
60 | |
61 | gdb_breakpoint [gdb_get_line_number "vla2-filled"] | |
62 | gdb_continue_to_breakpoint "vla2-filled" | |
bc68014d | 63 | gdb_test "ptype vla2" "type = $real, allocatable \\\(7,42:50,13:35\\\)" \ |
3f2f83dd | 64 | "ptype vla2 filled" |
0c13f7e5 | 65 | gdb_test "ptype vla2(5, 45, 20)" "type = $real" \ |
e0f86435 | 66 | "ptype vla2(5, 45, 20) filled" |
3f2f83dd KB |
67 | |
68 | gdb_breakpoint [gdb_get_line_number "pvla-associated"] | |
69 | gdb_continue_to_breakpoint "pvla-associated" | |
0c13f7e5 | 70 | gdb_test "ptype pvla" "type = $real \\\(10,10,10\\\)" \ |
3f2f83dd | 71 | "ptype pvla associated" |
d1e36019 | 72 | gdb_test "ptype pvla(3, 6, 9)" "type = $real" |
3f2f83dd KB |
73 | |
74 | gdb_breakpoint [gdb_get_line_number "pvla-re-associated"] | |
75 | gdb_continue_to_breakpoint "pvla-re-associated" | |
0c13f7e5 | 76 | gdb_test "ptype pvla" "type = $real \\\(7,42:50,13:35\\\)" \ |
3f2f83dd | 77 | "ptype pvla re-associated" |
0c13f7e5 | 78 | gdb_test "ptype vla2(5, 45, 20)" "type = $real" \ |
e0f86435 | 79 | "ptype vla2(5, 45, 20) re-associated" |
3f2f83dd KB |
80 | |
81 | gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] | |
82 | gdb_continue_to_breakpoint "pvla-deassociated" | |
584a927c | 83 | gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla deassociated" |
3f2f83dd KB |
84 | gdb_test "ptype pvla(5, 45, 20)" \ |
85 | "no such vector element \\\(vector not associated\\\)" \ | |
86 | "ptype pvla(5, 45, 20) not associated" | |
87 | ||
88 | gdb_breakpoint [gdb_get_line_number "vla1-deallocated"] | |
89 | gdb_continue_to_breakpoint "vla1-deallocated" | |
584a927c | 90 | gdb_test "ptype vla1" "type = $real, allocatable \\(:,:,:\\)" "ptype vla1 not allocated" |
3f2f83dd KB |
91 | gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \ |
92 | "ptype vla1(3, 6, 9) not allocated" | |
93 | ||
94 | gdb_breakpoint [gdb_get_line_number "vla2-deallocated"] | |
95 | gdb_continue_to_breakpoint "vla2-deallocated" | |
584a927c | 96 | gdb_test "ptype vla2" "type = $real, allocatable \\(:,:,:\\)" "ptype vla2 not allocated" |
3f2f83dd KB |
97 | gdb_test "ptype vla2(5, 45, 20)" \ |
98 | "no such vector element \\\(vector not allocated\\\)" \ | |
99 | "ptype vla2(5, 45, 20) not allocated" | |
0d4e84ed AB |
100 | |
101 | gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"] | |
102 | gdb_continue_to_breakpoint "vla1-neg-bounds-v1" | |
103 | gdb_test "ptype vla1" \ | |
104 | "type = $real, allocatable \\(-2:-1,-5:-2,-3:-1\\)" \ | |
105 | "ptype vla1 negative bounds" | |
106 | ||
107 | gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v2"] | |
108 | gdb_continue_to_breakpoint "vla1-neg-bounds-v2" | |
109 | gdb_test "ptype vla1" \ | |
110 | "type = $real, allocatable \\(-2:1,-5:2,-3:1\\)" \ | |
111 | "ptype vla1 negative lower bounds, positive upper bounds" |