OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [bound_2.f90] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! PR fortran/29391
3
! This file is here to check that LBOUND and UBOUND return correct values
4
!
5
! Contributed by Francois-Xavier Coudert (coudert@clipper.ens.fr)
6
  implicit none
7
  integer :: i(-1:1,-1:1) = 0
8
  integer :: j(-1:2) = 0
9
  integer :: u(7,4,2,9)
10
 
11
  call foo(u,4)
12
  call jackal(-1,-8)
13
  call jackal(-1,8)
14
 
15
  if (any(lbound(i(-1:1,-1:1)) /= 1)) call abort
16
  if (lbound(i(-1:1,-1:1), 1) /= 1) call abort
17
  if (lbound(i(-1:1,-1:1), 2) /= 1) call abort
18
 
19
  if (any(ubound(i(-1:1,-1:1)) /= 3)) call abort
20
  if (ubound(i(-1:1,-1:1), 1) /= 3) call abort
21
  if (ubound(i(-1:1,-1:1), 2) /= 3) call abort
22
 
23
  if (any(lbound(i(:,:)) /= 1)) call abort
24
  if (lbound(i(:,:), 1) /= 1) call abort
25
  if (lbound(i(:,:), 2) /= 1) call abort
26
 
27
  if (any(ubound(i(:,:)) /= 3)) call abort
28
  if (ubound(i(:,:), 1) /= 3) call abort
29
  if (ubound(i(:,:), 2) /= 3) call abort
30
 
31
  if (any(lbound(i(0:,-1:)) /= 1)) call abort
32
  if (lbound(i(0:,-1:), 1) /= 1) call abort
33
  if (lbound(i(0:,-1:), 2) /= 1) call abort
34
 
35
  if (any(ubound(i(0:,-1:)) /= [2,3])) call abort
36
  if (ubound(i(0:,-1:), 1) /= 2) call abort
37
  if (ubound(i(0:,-1:), 2) /= 3) call abort
38
 
39
  if (any(lbound(i(:0,:0)) /= 1)) call abort
40
  if (lbound(i(:0,:0), 1) /= 1) call abort
41
  if (lbound(i(:0,:0), 2) /= 1) call abort
42
 
43
  if (any(ubound(i(:0,:0)) /= 2)) call abort
44
  if (ubound(i(:0,:0), 1) /= 2) call abort
45
  if (ubound(i(:0,:0), 2) /= 2) call abort
46
 
47
  if (any(lbound(transpose(i)) /= 1)) call abort
48
  if (lbound(transpose(i), 1) /= 1) call abort
49
  if (lbound(transpose(i), 2) /= 1) call abort
50
 
51
  if (any(ubound(transpose(i)) /= 3)) call abort
52
  if (ubound(transpose(i), 1) /= 3) call abort
53
  if (ubound(transpose(i), 2) /= 3) call abort
54
 
55
  if (any(lbound(reshape(i,[2,2])) /= 1)) call abort
56
  if (lbound(reshape(i,[2,2]), 1) /= 1) call abort
57
  if (lbound(reshape(i,[2,2]), 2) /= 1) call abort
58
 
59
  if (any(ubound(reshape(i,[2,2])) /= 2)) call abort
60
  if (ubound(reshape(i,[2,2]), 1) /= 2) call abort
61
  if (ubound(reshape(i,[2,2]), 2) /= 2) call abort
62
 
63
  if (any(lbound(cshift(i,-1)) /= 1)) call abort
64
  if (lbound(cshift(i,-1), 1) /= 1) call abort
65
  if (lbound(cshift(i,-1), 2) /= 1) call abort
66
 
67
  if (any(ubound(cshift(i,-1)) /= 3)) call abort
68
  if (ubound(cshift(i,-1), 1) /= 3) call abort
69
  if (ubound(cshift(i,-1), 2) /= 3) call abort
70
 
71
  if (any(lbound(eoshift(i,-1)) /= 1)) call abort
72
  if (lbound(eoshift(i,-1), 1) /= 1) call abort
73
  if (lbound(eoshift(i,-1), 2) /= 1) call abort
74
 
75
  if (any(ubound(eoshift(i,-1)) /= 3)) call abort
76
  if (ubound(eoshift(i,-1), 1) /= 3) call abort
77
  if (ubound(eoshift(i,-1), 2) /= 3) call abort
78
 
79
  if (any(lbound(spread(i,1,2)) /= 1)) call abort
80
  if (lbound(spread(i,1,2), 1) /= 1) call abort
81
  if (lbound(spread(i,1,2), 2) /= 1) call abort
82
 
83
  if (any(ubound(spread(i,1,2)) /= [2,3,3])) call abort
84
  if (ubound(spread(i,1,2), 1) /= 2) call abort
85
  if (ubound(spread(i,1,2), 2) /= 3) call abort
86
  if (ubound(spread(i,1,2), 3) /= 3) call abort
87
 
88
  if (any(lbound(maxloc(i)) /= 1)) call abort
89
  if (lbound(maxloc(i), 1) /= 1) call abort
90
 
91
  if (any(ubound(maxloc(i)) /= 2)) call abort
92
  if (ubound(maxloc(i), 1) /= 2) call abort
93
 
94
  if (any(lbound(minloc(i)) /= 1)) call abort
95
  if (lbound(minloc(i), 1) /= 1) call abort
96
 
97
  if (any(ubound(minloc(i)) /= 2)) call abort
98
  if (ubound(minloc(i), 1) /= 2) call abort
99
 
100
  if (any(lbound(maxval(i,2)) /= 1)) call abort
101
  if (lbound(maxval(i,2), 1) /= 1) call abort
102
 
103
  if (any(ubound(maxval(i,2)) /= 3)) call abort
104
  if (ubound(maxval(i,2), 1) /= 3) call abort
105
 
106
  if (any(lbound(minval(i,2)) /= 1)) call abort
107
  if (lbound(minval(i,2), 1) /= 1) call abort
108
 
109
  if (any(ubound(minval(i,2)) /= 3)) call abort
110
  if (ubound(minval(i,2), 1) /= 3) call abort
111
 
112
  if (any(lbound(any(i==1,2)) /= 1)) call abort
113
  if (lbound(any(i==1,2), 1) /= 1) call abort
114
 
115
  if (any(ubound(any(i==1,2)) /= 3)) call abort
116
  if (ubound(any(i==1,2), 1) /= 3) call abort
117
 
118
  if (any(lbound(count(i==1,2)) /= 1)) call abort
119
  if (lbound(count(i==1,2), 1) /= 1) call abort
120
 
121
  if (any(ubound(count(i==1,2)) /= 3)) call abort
122
  if (ubound(count(i==1,2), 1) /= 3) call abort
123
 
124
  if (any(lbound(merge(i,i,.true.)) /= 1)) call abort
125
  if (lbound(merge(i,i,.true.), 1) /= 1) call abort
126
  if (lbound(merge(i,i,.true.), 2) /= 1) call abort
127
 
128
  if (any(ubound(merge(i,i,.true.)) /= 3)) call abort
129
  if (ubound(merge(i,i,.true.), 1) /= 3) call abort
130
  if (ubound(merge(i,i,.true.), 2) /= 3) call abort
131
 
132
  if (any(lbound(lbound(i)) /= 1)) call abort
133
  if (lbound(lbound(i), 1) /= 1) call abort
134
 
135
  if (any(ubound(lbound(i)) /= 2)) call abort
136
  if (ubound(lbound(i), 1) /= 2) call abort
137
 
138
  if (any(lbound(ubound(i)) /= 1)) call abort
139
  if (lbound(ubound(i), 1) /= 1) call abort
140
 
141
  if (any(ubound(ubound(i)) /= 2)) call abort
142
  if (ubound(ubound(i), 1) /= 2) call abort
143
 
144
  if (any(lbound(shape(i)) /= 1)) call abort
145
  if (lbound(shape(i), 1) /= 1) call abort
146
 
147
  if (any(ubound(shape(i)) /= 2)) call abort
148
  if (ubound(shape(i), 1) /= 2) call abort
149
 
150
  if (any(lbound(product(i,2)) /= 1)) call abort
151
  if (any(ubound(product(i,2)) /= 3)) call abort
152
  if (any(lbound(sum(i,2)) /= 1)) call abort
153
  if (any(ubound(sum(i,2)) /= 3)) call abort
154
  if (any(lbound(matmul(i,i)) /= 1)) call abort
155
  if (any(ubound(matmul(i,i)) /= 3)) call abort
156
  if (any(lbound(pack(i,.true.)) /= 1)) call abort
157
  if (any(ubound(pack(i,.true.)) /= 9)) call abort
158
  if (any(lbound(unpack(j,[.true.],[2])) /= 1)) call abort
159
  if (any(ubound(unpack(j,[.true.],[2])) /= 1)) call abort
160
 
161
  call sub1(i,3)
162
  call sub1(reshape([7,9,4,6,7,9],[3,2]),3)
163
  call sub2
164
 
165
contains
166
 
167
  subroutine sub1(a,n)
168
    integer :: a(2:n+1,4:*), n
169
 
170
    if (any([lbound(a,1), lbound(a,2)] /= [2, 4])) call abort
171
    if (any(lbound(a) /= [2, 4])) call abort
172
  end subroutine sub1
173
 
174
  subroutine sub2
175
    integer :: x(3:2, 1:2)
176
 
177
    if (size(x) /= 0) call abort
178
    if (lbound (x, 1) /= 1 .or. lbound(x, 2) /= 1) call abort
179
    if (any (lbound (x) /= [1, 1])) call abort
180
    if (ubound (x, 1) /= 0 .or. ubound(x, 2) /= 2) call abort
181
    if (any (ubound (x) /= [0, 2])) call abort
182
  end subroutine sub2
183
 
184
  subroutine sub3
185
    integer :: x(4:5, 1:2)
186
 
187
    if (size(x) /= 0) call abort
188
    if (lbound (x, 1) /= 4 .or. lbound(x, 2) /= 1) call abort
189
    if (any (lbound (x) /= [4, 1])) call abort
190
    if (ubound (x, 1) /= 4 .or. ubound(x, 2) /= 2) call abort
191
    if (any (ubound (x) /= [4, 2])) call abort
192
  end subroutine sub3
193
 
194
  subroutine foo (x,n)
195
    integer :: x(7,n,2,*), n
196
 
197
    if (ubound(x,1) /= 7 .or. ubound(x,2) /= 4 .or. ubound(x,3) /= 2) call abort
198
  end subroutine foo
199
 
200
  subroutine jackal (b, c)
201
    integer :: b, c
202
    integer :: soda(b:c, 3:4)
203
 
204
    if (b > c) then
205
      if (size(soda) /= 0) call abort
206
      if (lbound (soda, 1) /= 1 .or. ubound (soda, 1) /= 0) call abort
207
    else
208
      if (size(soda) /= 2*(c-b+1)) call abort
209
      if (lbound (soda, 1) /= b .or. ubound (soda, 1) /= c) call abort
210
    end if
211
 
212
    if (lbound (soda, 2) /= 3 .or. ubound (soda, 2) /= 4) call abort
213
    if (any (lbound (soda) /= [lbound(soda,1), lbound(soda,2)])) call abort
214
    if (any (ubound (soda) /= [ubound(soda,1), ubound(soda,2)])) call abort
215
 
216
  end subroutine jackal
217
 
218
end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.