Fix zero_ext documentation
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-ptype-sub.exp
1 # Copyright 2015-2016 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-sub.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 # Pass fixed array to function and handle them as vla in function.
29 gdb_breakpoint [gdb_get_line_number "not-filled"]
30 gdb_continue_to_breakpoint "not-filled (1st)"
31 gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(42,42\\\)" \
32 "ptype array1 (passed fixed)"
33 gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(42,42,42\\\)" \
34 "ptype array2 (passed fixed)"
35 gdb_test "ptype array1(40, 10)" "type = integer\\\(kind=4\\\)" \
36 "ptype array1(40, 10) (passed fixed)"
37 gdb_test "ptype array2(13, 11, 5)" "type = real\\\(kind=4\\\)" \
38 "ptype array2(13, 11, 5) (passed fixed)"
39
40 # Pass sub arrays to function and handle them as vla in function.
41 gdb_continue_to_breakpoint "not-filled (2nd)"
42 gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(6,6\\\)" \
43 "ptype array1 (passed sub-array)"
44 gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(6,6,6\\\)" \
45 "ptype array2 (passed sub-array)"
46 gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
47 "ptype array1(3, 3) (passed sub-array)"
48 gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
49 "ptype array2(4, 4, 4) (passed sub-array)"
50
51 # Check ptype outside of bounds. This should not crash GDB.
52 gdb_test "ptype array1(100, 100)" "no such vector element" \
53 "ptype array1(100, 100) subarray do not crash (passed sub-array)"
54 gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
55 "ptype array2(100, 100, 100) subarray do not crash (passed sub-array)"
56
57 # Pass vla to function.
58 gdb_continue_to_breakpoint "not-filled (3rd)"
59 gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(20,20\\\)" \
60 "ptype array1 (passed vla)"
61 gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
62 "ptype array2 (passed vla)"
63 gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
64 "ptype array1(3, 3) (passed vla)"
65 gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
66 "ptype array2(4, 4, 4) (passed vla)"
67
68 # Check ptype outside of bounds. This should not crash GDB.
69 gdb_test "ptype array1(100, 100)" "no such vector element" \
70 "ptype array1(100, 100) VLA do not crash (passed vla)"
71 gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
72 "ptype array2(100, 100, 100) VLA do not crash (passed vla)"
73
74 # Pass fixed array to function and handle it as VLA of arbitrary length in
75 # function.
76 gdb_breakpoint [gdb_get_line_number "end-of-bar"]
77 gdb_continue_to_breakpoint "end-of-bar"
78 gdb_test "ptype array1" \
79 "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" \
80 "ptype array1 (arbitrary length)"
81 gdb_test "ptype array2" \
82 "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(4:9,10:\\*\\)\\)?" \
83 "ptype array2 (arbitrary length)"
84 gdb_test "ptype array1(100)" "type = integer\\\(kind=4\\\)" \
85 "ptype array1(100) (arbitrary length)"
86 gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \
87 "ptype array2(4,100) (arbitrary length)"
This page took 0.03188 seconds and 4 git commands to generate.