]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-vla-intel-tests.patch
- up to 9.1
[packages/gdb.git] / gdb-vla-intel-tests.patch
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
5
6 ;;=fedoratest
7
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" \
14                "    $int :: i" \
15 -              "    PTR TO -> \\( $real :: ptr \\)" \
16 +              "    PTR TO -> \\( $real :: ptr\\)" \
17                "End Type tuserdef"]
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\\)\\)"
23  
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
28 new file mode 100644
29 --- /dev/null
30 +++ b/gdb/testsuite/gdb.fortran/vla-func.exp
31 @@ -0,0 +1,61 @@
32 +# Copyright 2014 Free Software Foundation, Inc.
33 +
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.
38 +#
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.
43 +#
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/>.
46 +
47 +standard_testfile ".f90"
48 +
49 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
50 +    {debug f90 quiet}] } {
51 +    return -1
52 +}
53 +
54 +if ![runto MAIN__] then {
55 +    perror "couldn't run to breakpoint MAIN__"
56 +    continue
57 +}
58 +
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, .\]*\\)" \
63 +  "print vla (func1)"
64 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \
65 +  "ptype vla (func1)"
66 +
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)"
71 +
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"
76 +
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\\\)" \
82 +  "print vla (func2)"
83 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
84 +  "ptype vla (func2)"
85 +
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
94 new file mode 100644
95 --- /dev/null
96 +++ b/gdb/testsuite/gdb.fortran/vla-func.f90
97 @@ -0,0 +1,71 @@
98 +! Copyright 2014 Free Software Foundation, Inc.
99 +!
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.
104 +!
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.
109 +!
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.
113 +
114 +logical function func1 (vla)
115 +  implicit none
116 +  integer, allocatable :: vla (:, :)
117 +  func1 = allocated(vla)
118 +  vla(5,5) = 55               ! func1-vla-passed
119 +  vla(7,7) = 77
120 +  return                      ! func1-vla-modified
121 +end function func1
122 +
123 +function func2(vla)
124 +  implicit none
125 +  integer :: vla (:)
126 +  integer :: func2(size(vla))
127 +  integer :: k
128 +
129 +  vla(1) = 1                    ! func2-vla-passed
130 +  vla(2) = 2
131 +  vla(4) = 4
132 +  vla(8) = 8
133 +
134 +  func2 = vla
135 +end function func2
136 +
137 +program vla_func
138 +  implicit none
139 +  interface
140 +    logical function func1 (vla)
141 +      integer, allocatable :: vla (:, :)
142 +    end function
143 +  end interface
144 +  interface
145 +    function func2 (vla)
146 +      integer :: vla (:)
147 +      integer func2(size(vla))
148 +    end function
149 +  end interface
150 +
151 +  logical :: ret
152 +  integer, allocatable :: vla1 (:, :)
153 +  integer, allocatable :: vla2 (:)
154 +  integer, allocatable :: vla3 (:)
155 +
156 +  ret = .FALSE.
157 +
158 +  allocate (vla1 (10,10))
159 +  vla1(:,:) = 22
160 +
161 +  allocate (vla2 (10))
162 +  vla2(:) = 44
163 +
164 +  ret = func1(vla1)
165 +  vla3 = func2(vla2)          ! func1-returned
166 +
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
180 new file mode 100644
181 --- /dev/null
182 +++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
183 @@ -0,0 +1,101 @@
184 +# Copyright 2014 Free Software Foundation, Inc.
185 +
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.
190 +#
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.
195 +#
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/>.
198 +
199 +standard_testfile ".f90"
200 +
201 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
202 +    {debug f90 quiet}] } {
203 +    return -1
204 +}
205 +
206 +# check that all fortran standard datatypes will be
207 +# handled correctly when using as VLA's
208 +
209 +if ![runto MAIN__] then {
210 +    perror "couldn't run to breakpoint MAIN__"
211 +    continue
212 +}
213 +
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"
226 +
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)"
240 +
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"
252 +
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"
263 +
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"
273 +
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
286 new file mode 100644
287 --- /dev/null
288 +++ b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
289 @@ -0,0 +1,40 @@
290 +! Copyright 2014 Free Software Foundation, Inc.
291 +!
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.
296 +!
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.
301 +!
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.
305 +
306 +program vla_strings
307 +  character(len=:), target, allocatable   :: var_char
308 +  character(len=:), pointer               :: var_char_p
309 +  logical                                 :: l
310 +
311 +  allocate(character(len=10) :: var_char)
312 +  l = allocated(var_char)                 ! var_char-allocated-1
313 +  var_char = 'foo'
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\\)"
339  
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" \
344                "    $int :: t3_i" \
345                "    Type t2 :: t2_n" \
346 -              "End Type t3 \\)"]
347 +              "End Type t3\\)"]
This page took 0.07498 seconds and 3 git commands to generate.