]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-vla-intel-tests.patch
- x32 patch no longer needed
[packages/gdb.git] / gdb-vla-intel-tests.patch
CommitLineData
4b0e5c1b
AM
1From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
2From: Fedora GDB patches <invalid@email.com>
3Date: Fri, 27 Oct 2017 21:07:50 +0200
4Subject: gdb-vla-intel-tests.patch
5
6FileName: gdb-vla-intel-tests.patch
7
8;;=fedoratest
9---
10 gdb/testsuite/gdb.fortran/vla-func.exp | 61 ++++++++++++++++
11 gdb/testsuite/gdb.fortran/vla-func.f90 | 71 +++++++++++++++++++
12 gdb/testsuite/gdb.fortran/vla-stringsold.exp | 101 +++++++++++++++++++++++++++
13 gdb/testsuite/gdb.fortran/vla-stringsold.f90 | 40 +++++++++++
14 4 files changed, 273 insertions(+)
15 create mode 100644 gdb/testsuite/gdb.fortran/vla-func.exp
16 create mode 100644 gdb/testsuite/gdb.fortran/vla-func.f90
17 create mode 100644 gdb/testsuite/gdb.fortran/vla-stringsold.exp
18 create mode 100644 gdb/testsuite/gdb.fortran/vla-stringsold.f90
19
20diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
21new file mode 100644
22index 0000000000..f0f236bef0
23--- /dev/null
24+++ b/gdb/testsuite/gdb.fortran/vla-func.exp
140f8057
JR
25@@ -0,0 +1,61 @@
26+# Copyright 2014 Free Software Foundation, Inc.
27+
28+# This program is free software; you can redistribute it and/or modify
29+# it under the terms of the GNU General Public License as published by
30+# the Free Software Foundation; either version 3 of the License, or
31+# (at your option) any later version.
32+#
33+# This program is distributed in the hope that it will be useful,
34+# but WITHOUT ANY WARRANTY; without even the implied warranty of
35+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36+# GNU General Public License for more details.
37+#
38+# You should have received a copy of the GNU General Public License
39+# along with this program. If not, see <http://www.gnu.org/licenses/>.
40+
41+standard_testfile ".f90"
42+
43+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
44+ {debug f90 quiet}] } {
45+ return -1
46+}
47+
48+if ![runto MAIN__] then {
49+ perror "couldn't run to breakpoint MAIN__"
50+ continue
51+}
52+
53+# Check VLA passed to first Fortran function.
54+gdb_breakpoint [gdb_get_line_number "func1-vla-passed"]
55+gdb_continue_to_breakpoint "func1-vla-passed"
56+gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
57+ "print vla (func1)"
58+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \
59+ "ptype vla (func1)"
60+
61+gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
62+gdb_continue_to_breakpoint "func1-vla-modified"
63+gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)"
64+gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)"
65+
66+# Check if the values are correct after returning from func1
67+gdb_breakpoint [gdb_get_line_number "func1-returned"]
68+gdb_continue_to_breakpoint "func1-returned"
69+gdb_test "print ret" " = .TRUE." "print ret after func1 returned"
70+
71+# Check VLA passed to second Fortran function
72+gdb_breakpoint [gdb_get_line_number "func2-vla-passed"]
73+gdb_continue_to_breakpoint "func2-vla-passed"
74+gdb_test "print vla" \
75+ " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \
76+ "print vla (func2)"
77+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
78+ "ptype vla (func2)"
79+
80+# Check if the returned VLA has the correct values and ptype.
81+gdb_breakpoint [gdb_get_line_number "func2-returned"]
82+gdb_continue_to_breakpoint "func2-returned"
83+gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
84+ "print vla3 (after func2)"
85+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
86+ "ptype vla3 (after func2)"
4b0e5c1b
AM
87diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90
88new file mode 100644
89index 0000000000..7540f54dbb
90--- /dev/null
91+++ b/gdb/testsuite/gdb.fortran/vla-func.f90
140f8057
JR
92@@ -0,0 +1,71 @@
93+! Copyright 2014 Free Software Foundation, Inc.
94+!
95+! This program is free software; you can redistribute it and/or modify
96+! it under the terms of the GNU General Public License as published by
97+! the Free Software Foundation; either version 2 of the License, or
98+! (at your option) any later version.
99+!
100+! This program is distributed in the hope that it will be useful,
101+! but WITHOUT ANY WARRANTY; without even the implied warranty of
102+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103+! GNU General Public License for more details.
104+!
105+! You should have received a copy of the GNU General Public License
106+! along with this program; if not, write to the Free Software
107+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
108+
109+logical function func1 (vla)
110+ implicit none
111+ integer, allocatable :: vla (:, :)
112+ func1 = allocated(vla)
113+ vla(5,5) = 55 ! func1-vla-passed
114+ vla(7,7) = 77
115+ return ! func1-vla-modified
116+end function func1
117+
118+function func2(vla)
119+ implicit none
120+ integer :: vla (:)
121+ integer :: func2(size(vla))
122+ integer :: k
123+
124+ vla(1) = 1 ! func2-vla-passed
125+ vla(2) = 2
126+ vla(4) = 4
127+ vla(8) = 8
128+
129+ func2 = vla
130+end function func2
131+
132+program vla_func
133+ implicit none
134+ interface
135+ logical function func1 (vla)
136+ integer, allocatable :: vla (:, :)
137+ end function
138+ end interface
139+ interface
140+ function func2 (vla)
141+ integer :: vla (:)
142+ integer func2(size(vla))
143+ end function
144+ end interface
145+
146+ logical :: ret
147+ integer, allocatable :: vla1 (:, :)
148+ integer, allocatable :: vla2 (:)
149+ integer, allocatable :: vla3 (:)
150+
151+ ret = .FALSE.
152+
153+ allocate (vla1 (10,10))
154+ vla1(:,:) = 22
155+
156+ allocate (vla2 (10))
157+ vla2(:) = 44
158+
159+ ret = func1(vla1)
160+ vla3 = func2(vla2) ! func1-returned
161+
162+ ret = .TRUE. ! func2-returned
163+end program vla_func
4b0e5c1b
AM
164diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
165new file mode 100644
166index 0000000000..c1bf7ef763
167--- /dev/null
168+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
140f8057
JR
169@@ -0,0 +1,101 @@
170+# Copyright 2014 Free Software Foundation, Inc.
171+
172+# This program is free software; you can redistribute it and/or modify
173+# it under the terms of the GNU General Public License as published by
174+# the Free Software Foundation; either version 3 of the License, or
175+# (at your option) any later version.
176+#
177+# This program is distributed in the hope that it will be useful,
178+# but WITHOUT ANY WARRANTY; without even the implied warranty of
179+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
180+# GNU General Public License for more details.
181+#
182+# You should have received a copy of the GNU General Public License
183+# along with this program. If not, see <http://www.gnu.org/licenses/>.
184+
185+standard_testfile ".f90"
186+
187+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
188+ {debug f90 quiet}] } {
189+ return -1
190+}
191+
192+# check that all fortran standard datatypes will be
193+# handled correctly when using as VLA's
194+
195+if ![runto MAIN__] then {
196+ perror "couldn't run to breakpoint MAIN__"
197+ continue
198+}
199+
200+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
201+gdb_continue_to_breakpoint "var_char-allocated-1"
202+gdb_test "print var_char" \
203+ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \
204+ "print var_char after allocated first time"
205+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \
206+ "whatis var_char first time"
207+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \
208+ "ptype var_char first time"
209+gdb_test "next" "\\d+.*var_char = 'foo'.*" \
210+ "next to allocation status of var_char"
211+gdb_test "print l" " = .TRUE." "print allocation status first time"
212+
213+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
214+gdb_continue_to_breakpoint "var_char-filled-1"
215+gdb_test "print var_char" \
216+ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \
217+ "print var_char after filled first time"
218+gdb_test "print *var_char" " = 'foo'" \
219+ "print *var_char after filled first time"
220+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \
221+ "whatis var_char after filled first time"
222+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \
223+ "ptype var_char after filled first time"
224+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
225+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
226+
227+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
228+gdb_continue_to_breakpoint "var_char-filled-2"
229+gdb_test "print var_char" \
230+ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \
231+ "print var_char after allocated second time"
232+gdb_test "print *var_char" " = 'foobar'" \
233+ "print *var_char after allocated second time"
234+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \
235+ "whatis var_char second time"
236+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \
237+ "ptype var_char second time"
238+
239+gdb_breakpoint [gdb_get_line_number "var_char-empty"]
240+gdb_continue_to_breakpoint "var_char-empty"
241+gdb_test "print var_char" \
242+ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \
243+ "print var_char after set empty"
244+gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
245+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \
246+ "whatis var_char after set empty"
247+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \
248+ "ptype var_char after set empty"
249+
250+gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
251+gdb_continue_to_breakpoint "var_char-allocated-3"
252+gdb_test "print var_char" \
253+ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \
254+ "print var_char after allocated third time"
255+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \
256+ "whatis var_char after allocated third time"
257+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \
258+ "ptype var_char after allocated third time"
259+
260+gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
261+gdb_continue_to_breakpoint "var_char_p-associated"
262+gdb_test "print var_char_p" \
263+ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \
264+ "print var_char_p after associated"
265+gdb_test "print *var_char_p" " = 'johndoe'" \
266+ "print *var_char_ after associated"
267+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
268+ "whatis var_char_p after associated"
269+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
270+ "ptype var_char_p after associated"
4b0e5c1b
AM
271diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.f90 b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
272new file mode 100644
273index 0000000000..0a1d5221d0
274--- /dev/null
275+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
140f8057
JR
276@@ -0,0 +1,40 @@
277+! Copyright 2014 Free Software Foundation, Inc.
278+!
279+! This program is free software; you can redistribute it and/or modify
280+! it under the terms of the GNU General Public License as published by
281+! the Free Software Foundation; either version 2 of the License, or
282+! (at your option) any later version.
283+!
284+! This program is distributed in the hope that it will be useful,
285+! but WITHOUT ANY WARRANTY; without even the implied warranty of
286+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
287+! GNU General Public License for more details.
288+!
289+! You should have received a copy of the GNU General Public License
290+! along with this program; if not, write to the Free Software
291+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
292+
293+program vla_strings
294+ character(len=:), target, allocatable :: var_char
295+ character(len=:), pointer :: var_char_p
296+ logical :: l
297+
298+ allocate(character(len=10) :: var_char)
299+ l = allocated(var_char) ! var_char-allocated-1
300+ var_char = 'foo'
301+ deallocate(var_char) ! var_char-filled-1
302+ l = allocated(var_char) ! var_char-deallocated
303+ allocate(character(len=42) :: var_char)
304+ l = allocated(var_char)
305+ var_char = 'foobar'
306+ var_char = '' ! var_char-filled-2
307+ var_char = 'bar' ! var_char-empty
308+ deallocate(var_char)
309+ allocate(character(len=21) :: var_char)
310+ l = allocated(var_char) ! var_char-allocated-3
311+ var_char = 'johndoe'
312+ var_char_p => var_char
313+ l = associated(var_char_p) ! var_char_p-associated
314+ var_char_p => null()
315+ l = associated(var_char_p) ! var_char_p-not-associated
316+end program vla_strings
4b0e5c1b
AM
317--
3182.14.3
319
This page took 0.095428 seconds and 4 git commands to generate.