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/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
9 --- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp
10 +++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
11 @@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1"
12 gdb_test "ptype tinsta" \
13 [multi_line "type = Type tuserdef" \
15 - " PTR TO -> \\( $real :: ptr \\)" \
16 + " PTR TO -> \\( $real :: ptr\\)" \
18 diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
19 --- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
20 +++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
21 @@ -42,4 +42,4 @@ gdb_test "ptype say_numbers" \
22 "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)"
24 gdb_test "ptype fun_ptr" \
25 - "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)"
26 + "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)"
27 diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
30 +++ b/gdb/testsuite/gdb.fortran/vla-func.exp
32 +# Copyright 2014 Free Software Foundation, Inc.
34 +# This program is free software; you can redistribute it and/or modify
35 +# it under the terms of the GNU General Public License as published by
36 +# the Free Software Foundation; either version 3 of the License, or
37 +# (at your option) any later version.
39 +# This program is distributed in the hope that it will be useful,
40 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
41 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 +# GNU General Public License for more details.
44 +# You should have received a copy of the GNU General Public License
45 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
47 +standard_testfile ".f90"
49 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
50 + {debug f90 quiet}] } {
54 +if ![runto MAIN__] then {
55 + perror "couldn't run to breakpoint MAIN__"
59 +# Check VLA passed to first Fortran function.
60 +gdb_breakpoint [gdb_get_line_number "func1-vla-passed"]
61 +gdb_continue_to_breakpoint "func1-vla-passed"
62 +gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
64 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \
67 +gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
68 +gdb_continue_to_breakpoint "func1-vla-modified"
69 +gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)"
70 +gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)"
72 +# Check if the values are correct after returning from func1
73 +gdb_breakpoint [gdb_get_line_number "func1-returned"]
74 +gdb_continue_to_breakpoint "func1-returned"
75 +gdb_test "print ret" " = .TRUE." "print ret after func1 returned"
77 +# Check VLA passed to second Fortran function
78 +gdb_breakpoint [gdb_get_line_number "func2-vla-passed"]
79 +gdb_continue_to_breakpoint "func2-vla-passed"
80 +gdb_test "print vla" \
81 + " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \
83 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
86 +# Check if the returned VLA has the correct values and ptype.
87 +gdb_breakpoint [gdb_get_line_number "func2-returned"]
88 +gdb_continue_to_breakpoint "func2-returned"
89 +gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
90 + "print vla3 (after func2)"
91 +gdb_test "ptype vla3" "type = integer\\\(kind=4\\\), allocatable \\\(10\\\)" \
92 + "ptype vla3 (after func2)"
93 diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90
96 +++ b/gdb/testsuite/gdb.fortran/vla-func.f90
98 +! Copyright 2014 Free Software Foundation, Inc.
100 +! This program is free software; you can redistribute it and/or modify
101 +! it under the terms of the GNU General Public License as published by
102 +! the Free Software Foundation; either version 2 of the License, or
103 +! (at your option) any later version.
105 +! This program is distributed in the hope that it will be useful,
106 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
107 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
108 +! GNU General Public License for more details.
110 +! You should have received a copy of the GNU General Public License
111 +! along with this program; if not, write to the Free Software
112 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
114 +logical function func1 (vla)
116 + integer, allocatable :: vla (:, :)
117 + func1 = allocated(vla)
118 + vla(5,5) = 55 ! func1-vla-passed
120 + return ! func1-vla-modified
126 + integer :: func2(size(vla))
129 + vla(1) = 1 ! func2-vla-passed
140 + logical function func1 (vla)
141 + integer, allocatable :: vla (:, :)
145 + function func2 (vla)
147 + integer func2(size(vla))
152 + integer, allocatable :: vla1 (:, :)
153 + integer, allocatable :: vla2 (:)
154 + integer, allocatable :: vla3 (:)
158 + allocate (vla1 (10,10))
161 + allocate (vla2 (10))
165 + vla3 = func2(vla2) ! func1-returned
167 + ret = .TRUE. ! func2-returned
168 +end program vla_func
169 diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
170 --- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
171 +++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
172 @@ -28,5 +28,5 @@ if ![runto_main] {
173 # Check the status of a pointer to a dynamic array.
174 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
175 gdb_continue_to_breakpoint "pvla-associated"
176 -gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\) \\)\\) ${hex}" \
177 +gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\)\\)\\) ${hex}" \
178 "print pvla pointer information"
179 diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
182 +++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
184 +# Copyright 2014 Free Software Foundation, Inc.
186 +# This program is free software; you can redistribute it and/or modify
187 +# it under the terms of the GNU General Public License as published by
188 +# the Free Software Foundation; either version 3 of the License, or
189 +# (at your option) any later version.
191 +# This program is distributed in the hope that it will be useful,
192 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
193 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
194 +# GNU General Public License for more details.
196 +# You should have received a copy of the GNU General Public License
197 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
199 +standard_testfile ".f90"
201 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
202 + {debug f90 quiet}] } {
206 +# check that all fortran standard datatypes will be
207 +# handled correctly when using as VLA's
209 +if ![runto MAIN__] then {
210 + perror "couldn't run to breakpoint MAIN__"
214 +gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
215 +gdb_continue_to_breakpoint "var_char-allocated-1"
216 +gdb_test "print var_char" \
217 + " = \\(PTR TO -> \\( character\\*10\\)\\) ${hex}" \
218 + "print var_char after allocated first time"
219 +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10\\)" \
220 + "whatis var_char first time"
221 +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10\\)" \
222 + "ptype var_char first time"
223 +gdb_test "next" "\\d+.*var_char = 'foo'.*" \
224 + "next to allocation status of var_char"
225 +gdb_test "print l" " = .TRUE." "print allocation status first time"
227 +gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
228 +gdb_continue_to_breakpoint "var_char-filled-1"
229 +gdb_test "print var_char" \
230 + " = \\(PTR TO -> \\( character\\*3\\)\\) ${hex}" \
231 + "print var_char after filled first time"
232 +gdb_test "print *var_char" " = 'foo'" \
233 + "print *var_char after filled first time"
234 +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3\\)" \
235 + "whatis var_char after filled first time"
236 +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3\\)" \
237 + "ptype var_char after filled first time"
238 +gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
239 +gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
241 +gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
242 +gdb_continue_to_breakpoint "var_char-filled-2"
243 +gdb_test "print var_char" \
244 + " = \\(PTR TO -> \\( character\\*6\\)\\) ${hex}" \
245 + "print var_char after allocated second time"
246 +gdb_test "print *var_char" " = 'foobar'" \
247 + "print *var_char after allocated second time"
248 +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6\\)" \
249 + "whatis var_char second time"
250 +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6\\)" \
251 + "ptype var_char second time"
253 +gdb_breakpoint [gdb_get_line_number "var_char-empty"]
254 +gdb_continue_to_breakpoint "var_char-empty"
255 +gdb_test "print var_char" \
256 + " = \\(PTR TO -> \\( character\\*0\\)\\) ${hex}" \
257 + "print var_char after set empty"
258 +gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
259 +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0\\)" \
260 + "whatis var_char after set empty"
261 +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0\\)" \
262 + "ptype var_char after set empty"
264 +gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
265 +gdb_continue_to_breakpoint "var_char-allocated-3"
266 +gdb_test "print var_char" \
267 + " = \\(PTR TO -> \\( character\\*21\\)\\) ${hex}" \
268 + "print var_char after allocated third time"
269 +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21\\)" \
270 + "whatis var_char after allocated third time"
271 +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21\\)" \
272 + "ptype var_char after allocated third time"
274 +gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
275 +gdb_continue_to_breakpoint "var_char_p-associated"
276 +gdb_test "print var_char_p" \
277 + " = \\(PTR TO -> \\( character\\*7\\)\\) ${hex}" \
278 + "print var_char_p after associated"
279 +gdb_test "print *var_char_p" " = 'johndoe'" \
280 + "print *var_char_ after associated"
281 +gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7\\)" \
282 + "whatis var_char_p after associated"
283 +gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7\\)" \
284 + "ptype var_char_p after associated"
285 diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.f90 b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
288 +++ b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
290 +! Copyright 2014 Free Software Foundation, Inc.
292 +! This program is free software; you can redistribute it and/or modify
293 +! it under the terms of the GNU General Public License as published by
294 +! the Free Software Foundation; either version 2 of the License, or
295 +! (at your option) any later version.
297 +! This program is distributed in the hope that it will be useful,
298 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
299 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
300 +! GNU General Public License for more details.
302 +! You should have received a copy of the GNU General Public License
303 +! along with this program; if not, write to the Free Software
304 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
307 + character(len=:), target, allocatable :: var_char
308 + character(len=:), pointer :: var_char_p
311 + allocate(character(len=10) :: var_char)
312 + l = allocated(var_char) ! var_char-allocated-1
314 + deallocate(var_char) ! var_char-filled-1
315 + l = allocated(var_char) ! var_char-deallocated
316 + allocate(character(len=42) :: var_char)
317 + l = allocated(var_char)
318 + var_char = 'foobar'
319 + var_char = '' ! var_char-filled-2
320 + var_char = 'bar' ! var_char-empty
321 + deallocate(var_char)
322 + allocate(character(len=21) :: var_char)
323 + l = allocated(var_char) ! var_char-allocated-3
324 + var_char = 'johndoe'
325 + var_char_p => var_char
326 + l = associated(var_char_p) ! var_char_p-associated
327 + var_char_p => null()
328 + l = associated(var_char_p) ! var_char_p-not-associated
329 +end program vla_strings
330 diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
331 --- a/gdb/testsuite/gdb.fortran/whatis_type.exp
332 +++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
333 @@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2"
334 gdb_test "whatis t2v" "type = Type t2"
335 gdb_test "whatis t3" "type = Type t3"
336 gdb_test "whatis t3v" "type = Type t3"
337 -gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)"
338 +gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)"
340 gdb_test "ptype t1" \
341 [multi_line "type = Type t1" \
342 @@ -73,4 +73,4 @@ gdb_test "ptype t3p" \
343 [multi_line "type = PTR TO -> \\( Type t3" \