Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2016-2020 Free Software Foundation, Inc. |
a5fd13a9 BH |
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 | # Test anonymous block-data statements. | |
17 | ||
18 | # A name for BLOCK DATA in Fortran is optional. BLOCK DATA is used | |
19 | # for one-time initialization of non-pointer variables in named common | |
20 | # blocks. GDB used to crash with 'Intel ifort'-generated code, which | |
21 | # outputs nameless DW_TAG_module, unlike with gfortran which just | |
22 | # doesn't emit DW_TAG_module in this case. | |
23 | ||
24 | if { [skip_fortran_tests] } { return -1 } | |
25 | ||
26 | standard_testfile .f | |
27 | load_lib "fortran.exp" | |
28 | ||
29 | if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { | |
30 | return -1 | |
31 | } | |
32 | ||
86cd6bc8 AKS |
33 | if ![fortran_runto_main] then { |
34 | untested "couldn't run to main" | |
a5fd13a9 BH |
35 | return -1 |
36 | } | |
37 | ||
38 | with_test_prefix "default values" { | |
39 | gdb_test "print doub1" "= 1\.11\\d+" | |
40 | gdb_test "print doub2" "= 2\.22\\d+" | |
41 | gdb_test "print char1" "= 'abcdef'" | |
42 | gdb_test "print char2" "= 'ghijkl'" | |
43 | } | |
44 | ||
45 | gdb_breakpoint [gdb_get_line_number "! BP_BEFORE_SUB"] | |
46 | gdb_continue_to_breakpoint "! BP_BEFORE_SUB" ".*! BP_BEFORE_SUB.*" | |
47 | ||
48 | with_test_prefix "before sub" { | |
49 | gdb_test "print doub1" "= 11\.11\\d+" | |
50 | gdb_test "print doub2" "= 22\.22\\d+" | |
51 | gdb_test "print char1" "= 'ABCDEF'" | |
52 | gdb_test "print char2" "= 'GHIJKL'" | |
53 | } | |
54 | ||
55 | gdb_breakpoint [gdb_get_line_number "! BP_SUB"] | |
56 | gdb_continue_to_breakpoint "! BP_SUB" ".*! BP_SUB.*" | |
57 | ||
58 | with_test_prefix "in sub" { | |
59 | gdb_test "print doub1" "= 11\.11\\d+" | |
60 | gdb_test "print doub2" "= 22\.22\\d+" | |
61 | gdb_test "print char1" "= 'ABCDEF'" | |
62 | gdb_test "print char2" "= 'GHIJKL'" | |
63 | } |