]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/vla-value-sub.exp
gdb/fortran: Allow Flang MAIN_ in Fortran testing
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-value-sub.exp
CommitLineData
b811d2c2 1# Copyright 2015-2020 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"
86cd6bc8 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
86cd6bc8 24if ![fortran_runto_main] {
3f2f83dd
KB
25 untested "could not run to main"
26 return -1
27}
28
29# Check the values of VLA's in subroutine can be evaluated correctly
30
31# Try to access values from a fixed array handled as VLA in subroutine.
32gdb_breakpoint [gdb_get_line_number "not-filled"]
33gdb_continue_to_breakpoint "not-filled (1st)"
34gdb_test "print array1" " = \\(\[()1, .\]*\\)" \
35 "print passed array1 in foo (passed fixed array)"
36
37gdb_breakpoint [gdb_get_line_number "array1-filled"]
38gdb_continue_to_breakpoint "array1-filled (1st)"
39gdb_test "print array1(5, 7)" " = 5" \
40 "print array1(5, 7) after filled in foo (passed fixed array)"
41gdb_test "print array1(1, 1)" " = 30" \
42 "print array1(1, 1) after filled in foo (passed fixed array)"
43
44gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
45gdb_continue_to_breakpoint "array2-almost-filled (1st)"
e9fb005c
JK
46# array2 size is 296352 bytes.
47gdb_test_no_output "set max-value-size 1024*1024"
3f2f83dd
KB
48gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
49 "print array2 in foo after it was filled (passed fixed array)"
50gdb_test "print array2(2,1,1)=20" " = 20" \
51 "set array(2,2,2) to 20 in subroutine (passed fixed array)"
52gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
53 "print array2 in foo after it was mofified in debugger (passed fixed array)"
54
55
56# Try to access values from a fixed sub-array handled as VLA in subroutine.
57gdb_continue_to_breakpoint "not-filled (2nd)"
58gdb_test "print array1" " = \\(\[()5, .\]*\\)" \
59 "print passed array1 in foo (passed sub-array)"
60
61gdb_continue_to_breakpoint "array1-filled (2nd)"
62gdb_test "print array1(5, 5)" " = 5" \
63 "print array1(5, 5) after filled in foo (passed sub-array)"
64gdb_test "print array1(1, 1)" " = 30" \
65 "print array1(1, 1) after filled in foo (passed sub-array)"
66
67gdb_continue_to_breakpoint "array2-almost-filled (2nd)"
68gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
69 "print array2 in foo after it was filled (passed sub-array)"
70gdb_test "print array2(2,1,1)=20" " = 20" \
71 "set array(2,2,2) to 20 in subroutine (passed sub-array)"
72gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
73 "print array2 in foo after it was mofified in debugger (passed sub-array)"
74
75
76# Try to access values from a VLA passed to subroutine.
77gdb_continue_to_breakpoint "not-filled (3rd)"
78gdb_test "print array1" " = \\(\[()42, .\]*\\)" \
79 "print passed array1 in foo (passed vla)"
80
81gdb_continue_to_breakpoint "array1-filled (3rd)"
82gdb_test "print array1(5, 5)" " = 5" \
83 "print array1(5, 5) after filled in foo (passed vla)"
84gdb_test "print array1(1, 1)" " = 30" \
85 "print array1(1, 1) after filled in foo (passed vla)"
86
87gdb_continue_to_breakpoint "array2-almost-filled (3rd)"
88gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
89 "print array2 in foo after it was filled (passed vla)"
90gdb_test "print array2(2,1,1)=20" " = 20" \
91 "set array(2,2,2) to 20 in subroutine (passed vla)"
92gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
93 "print array2 in foo after it was mofified in debugger (passed vla)"