Remove path name from test case
[binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-datatypes.exp
1 # Copyright 2015-2023 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 require allow_fortran_tests
20
21 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
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
29 if ![fortran_runto_main] {
30 return -1
31 }
32
33 # Depending on the compiler being used, the type names can be printed differently.
34 set int [fortran_int4]
35 set real [fortran_real4]
36 set complex [fortran_complex4]
37 set logical [fortran_logical4]
38
39 gdb_breakpoint [gdb_get_line_number "vlas-allocated"]
40 gdb_continue_to_breakpoint "vlas-allocated"
41 gdb_test "next" " = allocated\\\(realvla\\\)" \
42 "next to allocation status of intvla"
43 gdb_test "print l" " = \\.TRUE\\." "intvla allocated"
44 gdb_test "next" " = allocated\\\(complexvla\\\)" \
45 "next to allocation status of realvla"
46 gdb_test "print l" " = \\.TRUE\\." "realvla allocated"
47 gdb_test "next" " = allocated\\\(logicalvla\\\)" \
48 "next to allocation status of complexvla"
49 gdb_test "print l" " = \\.TRUE\\." "complexvla allocated"
50 gdb_test "next" " = allocated\\\(charactervla\\\)" \
51 "next to allocation status of logicalvla"
52 gdb_test "print l" " = \\.TRUE\\." "logicalvla allocated"
53 gdb_test "next" "intvla\\\(:,:,:\\\) = 1" \
54 "next to allocation status of charactervla"
55 gdb_test "print l" " = \\.TRUE\\." "charactervla allocated"
56
57 gdb_breakpoint [gdb_get_line_number "vlas-initialized"]
58 gdb_continue_to_breakpoint "vlas-initialized"
59 gdb_test "ptype intvla" "type = $int, allocatable \\\(11,22,33\\\)"
60 gdb_test "ptype realvla" "type = $real, allocatable \\\(11,22,33\\\)"
61 gdb_test "ptype complexvla" "type = $complex, allocatable \\\(11,22,33\\\)"
62 gdb_test "ptype logicalvla" "type = $logical, allocatable \\\(11,22,33\\\)"
63 gdb_test "ptype charactervla" "type = character\\\*1, allocatable \\\(11,22,33\\\)"
64
65 gdb_test "print intvla(5,5,5)" " = 1" "print intvla(5,5,5) (1st)"
66 gdb_test "print realvla(5,5,5)" " = 3.14\\d+" \
67 "print realvla(5,5,5) (1st)"
68 gdb_test "print complexvla(5,5,5)" " = \\\(2,-3\\\)" \
69 "print complexvla(5,5,5) (1st)"
70 gdb_test "print logicalvla(5,5,5)" " = \\.TRUE\\." \
71 "print logicalvla(5,5,5) (1st)"
72 gdb_test "print charactervla(5,5,5)" " = 'K'" \
73 "print charactervla(5,5,5) (1st)"
74
75 gdb_breakpoint [gdb_get_line_number "vlas-modified"]
76 gdb_continue_to_breakpoint "vlas-modified"
77 gdb_test "print intvla(5,5,5)" " = 42" "print intvla(5,5,5) (2nd)"
78 gdb_test "print realvla(5,5,5)" " = 4.13\\d+" \
79 "print realvla(5,5,5) (2nd)"
80 gdb_test "print complexvla(5,5,5)" " = \\\(-3,2\\\)" \
81 "print complexvla(5,5,5) (2nd)"
82 gdb_test "print logicalvla(5,5,5)" " = \\.FALSE\\." \
83 "print logicalvla(5,5,5) (2nd)"
84 gdb_test "print charactervla(5,5,5)" " = 'X'" \
85 "print charactervla(5,5,5) (2nd)"