OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [bound_7.f90] - Blame information for rev 437

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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