Commit | Line | Data |
---|---|---|
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 | ||
16 | standard_testfile "vla-sub.f90" | |
86cd6bc8 | 17 | load_lib fortran.exp |
3f2f83dd | 18 | |
5b362f04 | 19 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ |
3f2f83dd KB |
20 | {debug f90 quiet}] } { |
21 | return -1 | |
22 | } | |
23 | ||
86cd6bc8 | 24 | if ![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. | |
32 | gdb_breakpoint [gdb_get_line_number "not-filled"] | |
33 | gdb_continue_to_breakpoint "not-filled (1st)" | |
34 | gdb_test "print array1" " = \\(\[()1, .\]*\\)" \ | |
35 | "print passed array1 in foo (passed fixed array)" | |
36 | ||
37 | gdb_breakpoint [gdb_get_line_number "array1-filled"] | |
38 | gdb_continue_to_breakpoint "array1-filled (1st)" | |
39 | gdb_test "print array1(5, 7)" " = 5" \ | |
40 | "print array1(5, 7) after filled in foo (passed fixed array)" | |
41 | gdb_test "print array1(1, 1)" " = 30" \ | |
42 | "print array1(1, 1) after filled in foo (passed fixed array)" | |
43 | ||
44 | gdb_breakpoint [gdb_get_line_number "array2-almost-filled"] | |
45 | gdb_continue_to_breakpoint "array2-almost-filled (1st)" | |
e9fb005c JK |
46 | # array2 size is 296352 bytes. |
47 | gdb_test_no_output "set max-value-size 1024*1024" | |
3f2f83dd KB |
48 | gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ |
49 | "print array2 in foo after it was filled (passed fixed array)" | |
50 | gdb_test "print array2(2,1,1)=20" " = 20" \ | |
51 | "set array(2,2,2) to 20 in subroutine (passed fixed array)" | |
52 | gdb_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. | |
57 | gdb_continue_to_breakpoint "not-filled (2nd)" | |
58 | gdb_test "print array1" " = \\(\[()5, .\]*\\)" \ | |
59 | "print passed array1 in foo (passed sub-array)" | |
60 | ||
61 | gdb_continue_to_breakpoint "array1-filled (2nd)" | |
62 | gdb_test "print array1(5, 5)" " = 5" \ | |
63 | "print array1(5, 5) after filled in foo (passed sub-array)" | |
64 | gdb_test "print array1(1, 1)" " = 30" \ | |
65 | "print array1(1, 1) after filled in foo (passed sub-array)" | |
66 | ||
67 | gdb_continue_to_breakpoint "array2-almost-filled (2nd)" | |
68 | gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ | |
69 | "print array2 in foo after it was filled (passed sub-array)" | |
70 | gdb_test "print array2(2,1,1)=20" " = 20" \ | |
71 | "set array(2,2,2) to 20 in subroutine (passed sub-array)" | |
72 | gdb_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. | |
77 | gdb_continue_to_breakpoint "not-filled (3rd)" | |
78 | gdb_test "print array1" " = \\(\[()42, .\]*\\)" \ | |
79 | "print passed array1 in foo (passed vla)" | |
80 | ||
81 | gdb_continue_to_breakpoint "array1-filled (3rd)" | |
82 | gdb_test "print array1(5, 5)" " = 5" \ | |
83 | "print array1(5, 5) after filled in foo (passed vla)" | |
84 | gdb_test "print array1(1, 1)" " = 30" \ | |
85 | "print array1(1, 1) after filled in foo (passed vla)" | |
86 | ||
87 | gdb_continue_to_breakpoint "array2-almost-filled (3rd)" | |
88 | gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ | |
89 | "print array2 in foo after it was filled (passed vla)" | |
90 | gdb_test "print array2(2,1,1)=20" " = 20" \ | |
91 | "set array(2,2,2) to 20 in subroutine (passed vla)" | |
92 | gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ | |
93 | "print array2 in foo after it was mofified in debugger (passed vla)" |