]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-vla-intel-tests.patch
- updated to 11.2
[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/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
9 new file mode 100644
10 --- /dev/null
11 +++ b/gdb/testsuite/gdb.fortran/vla-func.exp
12 @@ -0,0 +1,61 @@
13 +# Copyright 2014 Free Software Foundation, Inc.
14 +
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.
19 +#
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.
24 +#
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/>.
27 +
28 +standard_testfile ".f90"
29 +
30 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
31 +    {debug f90 quiet}] } {
32 +    return -1
33 +}
34 +
35 +if ![runto MAIN__] then {
36 +    perror "couldn't run to breakpoint MAIN__"
37 +    continue
38 +}
39 +
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, .\]*\\)" \
44 +  "print vla (func1)"
45 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \
46 +  "ptype vla (func1)"
47 +
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)"
52 +
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"
57 +
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\\\)" \
63 +  "print vla (func2)"
64 +gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
65 +  "ptype vla (func2)"
66 +
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
75 new file mode 100644
76 --- /dev/null
77 +++ b/gdb/testsuite/gdb.fortran/vla-func.f90
78 @@ -0,0 +1,71 @@
79 +! Copyright 2014 Free Software Foundation, Inc.
80 +!
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.
85 +!
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.
90 +!
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.
94 +
95 +logical function func1 (vla)
96 +  implicit none
97 +  integer, allocatable :: vla (:, :)
98 +  func1 = allocated(vla)
99 +  vla(5,5) = 55               ! func1-vla-passed
100 +  vla(7,7) = 77
101 +  return                      ! func1-vla-modified
102 +end function func1
103 +
104 +function func2(vla)
105 +  implicit none
106 +  integer :: vla (:)
107 +  integer :: func2(size(vla))
108 +  integer :: k
109 +
110 +  vla(1) = 1                    ! func2-vla-passed
111 +  vla(2) = 2
112 +  vla(4) = 4
113 +  vla(8) = 8
114 +
115 +  func2 = vla
116 +end function func2
117 +
118 +program vla_func
119 +  implicit none
120 +  interface
121 +    logical function func1 (vla)
122 +      integer, allocatable :: vla (:, :)
123 +    end function
124 +  end interface
125 +  interface
126 +    function func2 (vla)
127 +      integer :: vla (:)
128 +      integer func2(size(vla))
129 +    end function
130 +  end interface
131 +
132 +  logical :: ret
133 +  integer, allocatable :: vla1 (:, :)
134 +  integer, allocatable :: vla2 (:)
135 +  integer, allocatable :: vla3 (:)
136 +
137 +  ret = .FALSE.
138 +
139 +  allocate (vla1 (10,10))
140 +  vla1(:,:) = 22
141 +
142 +  allocate (vla2 (10))
143 +  vla2(:) = 44
144 +
145 +  ret = func1(vla1)
146 +  vla3 = func2(vla2)          ! func1-returned
147 +
148 +  ret = .TRUE.                ! func2-returned
149 +end program vla_func
This page took 0.654927 seconds and 3 git commands to generate.