Commit | Line | Data |
---|---|---|
3f2f83dd KB |
1 | # Copyright 2015 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 | ||
18 | if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ | |
19 | {debug f90 quiet}] } { | |
20 | return -1 | |
21 | } | |
22 | ||
23 | if ![runto_main] { | |
24 | untested "could not run to main" | |
25 | return -1 | |
26 | } | |
27 | ||
28 | # Check the ptype of various VLA states and pointer to VLA's. | |
29 | gdb_breakpoint [gdb_get_line_number "vla1-init"] | |
30 | gdb_continue_to_breakpoint "vla1-init" | |
31 | gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not initialized" | |
32 | gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not initialized" | |
33 | gdb_test "ptype pvla" "type = <not associated>" "ptype pvla not initialized" | |
34 | gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \ | |
35 | "ptype vla1(3, 6, 9) not initialized" | |
36 | gdb_test "ptype vla2(5, 45, 20)" \ | |
37 | "no such vector element \\\(vector not allocated\\\)" \ | |
38 | "ptype vla1(5, 45, 20) not initialized" | |
39 | ||
40 | gdb_breakpoint [gdb_get_line_number "vla1-allocated"] | |
41 | gdb_continue_to_breakpoint "vla1-allocated" | |
42 | gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ | |
43 | "ptype vla1 allocated" | |
44 | ||
45 | gdb_breakpoint [gdb_get_line_number "vla2-allocated"] | |
46 | gdb_continue_to_breakpoint "vla2-allocated" | |
47 | gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \ | |
48 | "ptype vla2 allocated" | |
49 | ||
50 | gdb_breakpoint [gdb_get_line_number "vla1-filled"] | |
51 | gdb_continue_to_breakpoint "vla1-filled" | |
52 | gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ | |
53 | "ptype vla1 filled" | |
54 | gdb_test "ptype vla1(3, 6, 9)" "type = real\\\(kind=4\\\)" \ | |
55 | "ptype vla1(3, 6, 9)" | |
56 | ||
57 | gdb_breakpoint [gdb_get_line_number "vla2-filled"] | |
58 | gdb_continue_to_breakpoint "vla2-filled" | |
59 | gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \ | |
60 | "ptype vla2 filled" | |
61 | gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \ | |
62 | "ptype vla1(5, 45, 20) filled" | |
63 | ||
64 | gdb_breakpoint [gdb_get_line_number "pvla-associated"] | |
65 | gdb_continue_to_breakpoint "pvla-associated" | |
66 | gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ | |
67 | "ptype pvla associated" | |
68 | gdb_test "ptype pvla(3, 6, 9)" "type = real\\\(kind=4\\\)" \ | |
69 | "ptype pvla(3, 6, 9)" | |
70 | ||
71 | gdb_breakpoint [gdb_get_line_number "pvla-re-associated"] | |
72 | gdb_continue_to_breakpoint "pvla-re-associated" | |
73 | gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \ | |
74 | "ptype pvla re-associated" | |
75 | gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \ | |
76 | "ptype vla1(5, 45, 20) re-associated" | |
77 | ||
78 | gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] | |
79 | gdb_continue_to_breakpoint "pvla-deassociated" | |
80 | gdb_test "ptype pvla" "type = <not associated>" "ptype pvla deassociated" | |
81 | gdb_test "ptype pvla(5, 45, 20)" \ | |
82 | "no such vector element \\\(vector not associated\\\)" \ | |
83 | "ptype pvla(5, 45, 20) not associated" | |
84 | ||
85 | gdb_breakpoint [gdb_get_line_number "vla1-deallocated"] | |
86 | gdb_continue_to_breakpoint "vla1-deallocated" | |
87 | gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not allocated" | |
88 | gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \ | |
89 | "ptype vla1(3, 6, 9) not allocated" | |
90 | ||
91 | gdb_breakpoint [gdb_get_line_number "vla2-deallocated"] | |
92 | gdb_continue_to_breakpoint "vla2-deallocated" | |
93 | gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not allocated" | |
94 | gdb_test "ptype vla2(5, 45, 20)" \ | |
95 | "no such vector element \\\(vector not allocated\\\)" \ | |
96 | "ptype vla2(5, 45, 20) not allocated" |