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