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