Jan van Oosterwijk said:
> One compiler gives an error message withe the following:
>
> forall(i = 1:n-1, j = i:m-1) ! <== line 39
> b(i, j) = a(merge(i,i+1,i<p), merge(j,j+1,j<q))
> end forall
>
> ! D:\Fortran\Cursus\F90\6\Opg>f95 forall-err.f90
> ! error on line 39 of forall-err.f90: "I" is a FORALL index variable
> ! it can not appear in the subscript list expressions.
With ours similarly, viz
Error: junkk.f90, line 5: FORALL index I referred to in same forall-triplet-spec-list
> The intent of this statement is to remove one row and one column from array
> "a".
> 1 <= p <= n and 1 <= q <= m are given.
>
> I can't find a restriction in the standard that forbids this.
I can. In the F2003 FCD it's C736 (page 149) which says
"A <subscript> or <stride> in a <forall-triplet-spec> shall not contain
a reference to any <index-name> in the <forall-triplet-spec-list> in
which it appears."
(The confusingly named <subscript> and <stride> are the initial, limit and
step expressions in the forall statement). As you might guess from the error
message, similar language appears in the F95 standard.
Looking at your intent, perhaps what you meant was:
forall (i=1:n-1)
forall (j=i:m-1)
...
???
As Richard explained, all the indices in a FORALL statement are handled
simultaneously, it's not a shorthand for nested FORALLs.
Hope this helps.
Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
|