[FORTRAN PATCH] PR30400: ANY not accepted as FORALL mask
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sun Feb 18 18:22:00 GMT 2007
Tobi,
> > there's one corner case which I think we should put into a testcase: a
> > mask expression which uses the '==' operator, something like "forall
> > (j=1:5, j==2)" The code in match_forall_iterator seems to be doing the
> > right thing when it sees this, but it's worth making sure.
> <var> = <start>:<end>[:<stride>][, <scalar mask>] */ ?
>
> 7.5.4.1
>
> R747 forall-construct is forall-construct-stmt
> [forall-body-construct ] ...
> end-forall-stmt
> R748 forall-construct-stmt is [forall-construct-name :] FORALL forall-header
> R749 forall-header is (forall-triplet-spec-list [, scalar-mask-expr] )
>
> It looks OK to me or am I missing something (wouldn't be the first time:))
>
> Paul
>
> --
> Anon: "Ignorantibus veritatem dicere semper utile est."
>
> Abraham Lincoln: "It is better to be thought a fool than to speak and
> remove all doubt."
Does forall_6.f90, with its "i < 3", satisfy you here or do you have
some specific concern about "=="?
! PR fortran/30404
! Checks that we correctly handle nested masks in nested FORALL blocks.
! Contributed by Paul Thomas <pault@gcc.gnu.org>
!
! { dg-do run }
logical :: l1(2,2)
integer :: it(2,2)
l1(:,:) = reshape ((/.false.,.true.,.true.,.false./), (/2,2/))
it(:,:) = reshape ((/1,2,3,4/), (/2,2/))
forall (i = 1:2, i < 3)
forall (j = 1:2, l1(i,j))
it(i, j) = 0
end forall
end forall
! print *, l1
! print '(4i2)', it
if (any (it .ne. reshape ((/1, 0, 0, 4/), (/2, 2/)))) call abort ()
end
Cheers
Paul
--
Anon: "Ignorantibus veritatem dicere semper utile est."
Abraham Lincoln: "It is better to be thought a fool than to speak and
remove all doubt."
More information about the Fortran
mailing list