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