1260684Skaiw# Copyright 2015-2023 Free Software Foundation, Inc.
2260684Skaiw
3260684Skaiw# This program is free software; you can redistribute it and/or modify
4260684Skaiw# it under the terms of the GNU General Public License as published by
5260684Skaiw# the Free Software Foundation; either version 3 of the License, or
6260684Skaiw# (at your option) any later version.
7260684Skaiw#
8260684Skaiw# This program is distributed in the hope that it will be useful,
9260684Skaiw# but WITHOUT ANY WARRANTY; without even the implied warranty of
10260684Skaiw# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11260684Skaiw# GNU General Public License for more details.
12260684Skaiw#
13260684Skaiw# You should have received a copy of the GNU General Public License
14260684Skaiw# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15260684Skaiw
16260684Skaiwstandard_testfile "vla-sub.f90"
17260684Skaiwload_lib fortran.exp
18260684Skaiw
19260684Skaiwif {[skip_fortran_tests]} { return -1 }
20260684Skaiw
21260684Skaiwif { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
22260684Skaiw    {debug f90 quiet}] } {
23260684Skaiw    return -1
24260684Skaiw}
25260684Skaiw
26260684Skaiwif ![fortran_runto_main] {
27260684Skaiw    return -1
28260684Skaiw}
29260684Skaiw
30260684Skaiw# Check VLA with arbitary length and check that elements outside of
31260684Skaiw# bounds of the passed VLA can be accessed correctly.
32260684Skaiwgdb_breakpoint [gdb_get_line_number "end-of-bar"]
33260684Skaiwgdb_continue_to_breakpoint "end-of-bar"
34260684Skaiwgdb_test "p array1(42)" " = 3" "print arbitary array1(42)"
35260684Skaiwgdb_test "p array1(100)" " = 100" "print arbitary array1(100)"
36260684Skaiwgdb_test "p array2(4,10)" " = 1" "print arbitary array2(4,10)"
37260684Skaiwgdb_test "p array2(4,100)" " = 1" "print arbitary array2(4,100)"
38260684Skaiw