Testsuite: Fix compiling of shared libraries with ICC.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-ptype-sub.exp
CommitLineData
618f726f 1# Copyright 2015-2016 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-sub.f90"
17
18if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
19 {debug f90 quiet}] } {
20 return -1
21}
22
23if ![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.
29gdb_breakpoint [gdb_get_line_number "not-filled"]
30gdb_continue_to_breakpoint "not-filled (1st)"
31gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(42,42\\\)" \
32 "ptype array1 (passed fixed)"
33gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(42,42,42\\\)" \
34 "ptype array2 (passed fixed)"
35gdb_test "ptype array1(40, 10)" "type = integer\\\(kind=4\\\)" \
36 "ptype array1(40, 10) (passed fixed)"
37gdb_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.
41gdb_continue_to_breakpoint "not-filled (2nd)"
42gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(6,6\\\)" \
43 "ptype array1 (passed sub-array)"
44gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(6,6,6\\\)" \
45 "ptype array2 (passed sub-array)"
46gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
47 "ptype array1(3, 3) (passed sub-array)"
48gdb_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.
52gdb_test "ptype array1(100, 100)" "no such vector element" \
53 "ptype array1(100, 100) subarray do not crash (passed sub-array)"
54gdb_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.
58gdb_continue_to_breakpoint "not-filled (3rd)"
59gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(20,20\\\)" \
60 "ptype array1 (passed vla)"
61gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
62 "ptype array2 (passed vla)"
63gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
64 "ptype array1(3, 3) (passed vla)"
65gdb_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.
69gdb_test "ptype array1(100, 100)" "no such vector element" \
70 "ptype array1(100, 100) VLA do not crash (passed vla)"
71gdb_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.
76gdb_breakpoint [gdb_get_line_number "end-of-bar"]
77gdb_continue_to_breakpoint "end-of-bar"
78gdb_test "ptype array1" \
79 "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" \
80 "ptype array1 (arbitrary length)"
81gdb_test "ptype array2" \
82 "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(4:9,10:\\*\\)\\)?" \
83 "ptype array2 (arbitrary length)"
84gdb_test "ptype array1(100)" "type = integer\\\(kind=4\\\)" \
85 "ptype array1(100) (arbitrary length)"
86gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \
87 "ptype array2(4,100) (arbitrary length)"
This page took 0.097007 seconds and 4 git commands to generate.