[PATCH] Fix gfortran.dg/forall_1.f90
Jakub Jelinek
jakub@redhat.com
Tue Jun 7 22:11:00 GMT 2005
On Tue, Jun 07, 2005 at 10:08:01PM +0200, Tobias Schl?ter wrote:
> Jakub Jelinek wrote:
> > Of course we only want to increment it in the innermost loop which
> > contains the load of the mask. Here is a fix, tested with no check-f95
> > failures on x86_64-linux. Ok for HEAD and 4.0.2?
> >
> > Alternatively, the increment could be moved to gfc_trans_nested_forall_loop
> > and body passed as stmtblock_t instead of tree. This change is shorter
> > though...
>
> The patch is ok for both provided you add more tests, the testcase I added is
> not really sufficient, because it doesn't have multi-dimensional masks or
> non-trivial dependencies between the mask and the assignments.
Attached are 2 testcases. The first compiles, but aborts at runtime
(from brief look it seems there is a missing clearing of a mi
variable between the loop filling the 125 entry temp array and
loop using it) and the second ICEs (not sure if the testcase is or is
not valid).
I'll look at the first problem tomorrow.
Jakub
-------------- next part --------------
! tests FORALL statements with a mask
program forall_7
real, dimension (5, 5, 5, 5) :: a
a (:, :, :, :) = 4
forall (i = 1:5)
a (i, i, 6 - i, i) = 7
end forall
forall (i = 1:5)
a (i, 6 - i, i, i) = 7
end forall
forall (i = 1:5)
a (6 - i, i, i, i) = 7
end forall
forall (i = 1:5:2)
a (1, 2, 3, i) = 0
end forall
forall (i = 1:5, j = 1:5, k = 1:5, ((a (i, j, k, i) .gt. 6) .or. (a (i, j, k, j) .gt. 6)))
forall (l = 1:5, a (1, 2, 3, l) .lt. 2)
a (i, j, k, l) = 35
end forall
end forall
do i = 1, 5
do j = 1, 5
do k = 1, 5
do l = 1, 5
r = 4
if ((i == j .and. k == 6 - i) .or. (i == k .and. j == 6 - i)) then
if (l /= 2 .and. l /= 4) then
r = i - j + k - l
elseif (l == i) then
r = 7
endif
elseif (j == k .and. i == 6 - j) then
if (l /= 2 .and. l /= 4) then
r = i - j + k - l
elseif (l == j) then
r = 7
endif
elseif (i == 1 .and. j == 2 .and. k == 3 .and. l /= 2 .and. l /= 4) then
r = 0
end if
if (a (i, j, k, l) /= r) call abort ()
end do
end do
end do
end do
end
-------------- next part --------------
! tests FORALL statements with a mask
program forall_8
real, dimension (5, 5, 5, 5) :: a
a (:, :, :, :) = 4
forall (i = 1:5)
a (i, i, 6 - i, i) = 7
end forall
forall (i = 1:5)
a (i, 6 - i, i, i) = 7
end forall
forall (i = 1:5)
a (6 - i, i, i, i) = 7
end forall
forall (i = 1:5:2)
a (1, 2, 3, i) = 0
end forall
forall (i = 1:5, j = 1:5, k = 1:5, any (a (i, j, k, :) .gt. 6))
forall (l = 1:5, any (a (:, :, :, l) .lt. 2))
a (i, j, k, l) = i - j + k - l
end forall
end forall
do i = 1, 5
do j = 1, 5
do k = 1, 5
do l = 1, 5
r = 4
if ((i == j .and. k == 6 - i) .or. (i == k .and. j == 6 - i)) then
if (l /= 2 .and. l /= 4) then
r = i - j + k - l
elseif (l == i) then
r = 7
endif
elseif (j == k .and. i == 6 - j) then
if (l /= 2 .and. l /= 4) then
r = i - j + k - l
elseif (l == j) then
r = 7
endif
elseif (i == 1 .and. j == 2 .and. k == 3 .and. l /= 2 .and. l /= 4) then
r = 0
end if
if (a (i, j, k, l) /= r) call abort ()
end do
end do
end do
end do
end
More information about the Fortran
mailing list