]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/vla-datatypes.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-datatypes.exp
CommitLineData
3666a048 1# Copyright 2015-2021 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 ".f90"
0c13f7e5 17load_lib "fortran.exp"
3f2f83dd 18
a54a7f13
PA
19if {[skip_fortran_tests]} { return -1 }
20
5b362f04 21if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
3f2f83dd
KB
22 {debug f90 quiet}] } {
23 return -1
24}
25
26# check that all fortran standard datatypes will be
27# handled correctly when using as VLA's
28
86cd6bc8 29if ![fortran_runto_main] {
3f2f83dd
KB
30 untested "could not run to main"
31 return -1
32}
33
0c13f7e5
BH
34# Depending on the compiler being used, the type names can be printed differently.
35set int [fortran_int4]
36set real [fortran_real4]
37set complex [fortran_complex4]
38set logical [fortran_logical4]
39
3f2f83dd
KB
40gdb_breakpoint [gdb_get_line_number "vlas-allocated"]
41gdb_continue_to_breakpoint "vlas-allocated"
42gdb_test "next" " = allocated\\\(realvla\\\)" \
43 "next to allocation status of intvla"
44gdb_test "print l" " = \\.TRUE\\." "intvla allocated"
45gdb_test "next" " = allocated\\\(complexvla\\\)" \
46 "next to allocation status of realvla"
47gdb_test "print l" " = \\.TRUE\\." "realvla allocated"
48gdb_test "next" " = allocated\\\(logicalvla\\\)" \
49 "next to allocation status of complexvla"
50gdb_test "print l" " = \\.TRUE\\." "complexvla allocated"
51gdb_test "next" " = allocated\\\(charactervla\\\)" \
52 "next to allocation status of logicalvla"
53gdb_test "print l" " = \\.TRUE\\." "logicalvla allocated"
54gdb_test "next" "intvla\\\(:,:,:\\\) = 1" \
55 "next to allocation status of charactervla"
56gdb_test "print l" " = \\.TRUE\\." "charactervla allocated"
57
58gdb_breakpoint [gdb_get_line_number "vlas-initialized"]
59gdb_continue_to_breakpoint "vlas-initialized"
d1e36019
TV
60gdb_test "ptype intvla" "type = $int, allocatable \\\(11,22,33\\\)"
61gdb_test "ptype realvla" "type = $real, allocatable \\\(11,22,33\\\)"
62gdb_test "ptype complexvla" "type = $complex, allocatable \\\(11,22,33\\\)"
63gdb_test "ptype logicalvla" "type = $logical, allocatable \\\(11,22,33\\\)"
64gdb_test "ptype charactervla" "type = character\\\*1, allocatable \\\(11,22,33\\\)"
3f2f83dd
KB
65
66gdb_test "print intvla(5,5,5)" " = 1" "print intvla(5,5,5) (1st)"
67gdb_test "print realvla(5,5,5)" " = 3.14\\d+" \
68 "print realvla(5,5,5) (1st)"
69gdb_test "print complexvla(5,5,5)" " = \\\(2,-3\\\)" \
70 "print complexvla(5,5,5) (1st)"
71gdb_test "print logicalvla(5,5,5)" " = \\.TRUE\\." \
72 "print logicalvla(5,5,5) (1st)"
73gdb_test "print charactervla(5,5,5)" " = 'K'" \
74 "print charactervla(5,5,5) (1st)"
75
76gdb_breakpoint [gdb_get_line_number "vlas-modified"]
77gdb_continue_to_breakpoint "vlas-modified"
78gdb_test "print intvla(5,5,5)" " = 42" "print intvla(5,5,5) (2nd)"
79gdb_test "print realvla(5,5,5)" " = 4.13\\d+" \
80 "print realvla(5,5,5) (2nd)"
81gdb_test "print complexvla(5,5,5)" " = \\\(-3,2\\\)" \
82 "print complexvla(5,5,5) (2nd)"
83gdb_test "print logicalvla(5,5,5)" " = \\.FALSE\\." \
84 "print logicalvla(5,5,5) (2nd)"
85gdb_test "print charactervla(5,5,5)" " = 'X'" \
86 "print charactervla(5,5,5) (2nd)"