1 From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
2 From: Fedora GDB patches <invalid@email.com>
3 Date: Fri, 27 Oct 2017 21:07:50 +0200
4 Subject: gdb-vla-intel-tests.patch
8 diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
11 +++ b/gdb/testsuite/gdb.fortran/vla-func.exp
13 +# Copyright 2014 Free Software Foundation, Inc.
15 +# This program is free software; you can redistribute it and/or modify
16 +# it under the terms of the GNU General Public License as published by
17 +# the Free Software Foundation; either version 3 of the License, or
18 +# (at your option) any later version.
20 +# This program is distributed in the hope that it will be useful,
21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 +# GNU General Public License for more details.
25 +# You should have received a copy of the GNU General Public License
26 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
28 +standard_testfile ".f90"
30 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
31 + {debug f90 quiet}] } {
35 +if ![runto MAIN__] then {
36 + perror "couldn't run to breakpoint MAIN__"
40 +# Check VLA passed to first Fortran function.
41 +gdb_breakpoint [gdb_get_line_number "func1-vla-passed"]
42 +gdb_continue_to_breakpoint "func1-vla-passed"
43 +gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
45 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \
48 +gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
49 +gdb_continue_to_breakpoint "func1-vla-modified"
50 +gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)"
51 +gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)"
53 +# Check if the values are correct after returning from func1
54 +gdb_breakpoint [gdb_get_line_number "func1-returned"]
55 +gdb_continue_to_breakpoint "func1-returned"
56 +gdb_test "print ret" " = .TRUE." "print ret after func1 returned"
58 +# Check VLA passed to second Fortran function
59 +gdb_breakpoint [gdb_get_line_number "func2-vla-passed"]
60 +gdb_continue_to_breakpoint "func2-vla-passed"
61 +gdb_test "print vla" \
62 + " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \
64 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
67 +# Check if the returned VLA has the correct values and ptype.
68 +gdb_breakpoint [gdb_get_line_number "func2-returned"]
69 +gdb_continue_to_breakpoint "func2-returned"
70 +gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
71 + "print vla3 (after func2)"
72 +gdb_test "ptype vla3" "type = integer\\\(kind=4\\\), allocatable \\\(10\\\)" \
73 + "ptype vla3 (after func2)"
74 diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90
77 +++ b/gdb/testsuite/gdb.fortran/vla-func.f90
79 +! Copyright 2014 Free Software Foundation, Inc.
81 +! This program is free software; you can redistribute it and/or modify
82 +! it under the terms of the GNU General Public License as published by
83 +! the Free Software Foundation; either version 2 of the License, or
84 +! (at your option) any later version.
86 +! This program is distributed in the hope that it will be useful,
87 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
88 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89 +! GNU General Public License for more details.
91 +! You should have received a copy of the GNU General Public License
92 +! along with this program; if not, write to the Free Software
93 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
95 +logical function func1 (vla)
97 + integer, allocatable :: vla (:, :)
98 + func1 = allocated(vla)
99 + vla(5,5) = 55 ! func1-vla-passed
101 + return ! func1-vla-modified
107 + integer :: func2(size(vla))
110 + vla(1) = 1 ! func2-vla-passed
121 + logical function func1 (vla)
122 + integer, allocatable :: vla (:, :)
126 + function func2 (vla)
128 + integer func2(size(vla))
133 + integer, allocatable :: vla1 (:, :)
134 + integer, allocatable :: vla2 (:)
135 + integer, allocatable :: vla3 (:)
139 + allocate (vla1 (10,10))
142 + allocate (vla2 (10))
146 + vla3 = func2(vla2) ! func1-returned
148 + ret = .TRUE. ! func2-returned
149 +end program vla_func