Subject: Re: triangular array access and assignment-only block foralls

From: [email-masked] (Andy Meltzer)
Date: Thu, 25 Jun 92 14:48:12 CDT

> > 	"Any storage location which is updated by one forall-block 
> > 	 (in a function, subroutine, or assignment) may not be 
> > 	 updated or read by any other forall-block."
> > 
> > I think this is clear and it leaves a very powerful construct for the user.
> > It also makes illegal all non-deterministic programs.  Its only drawback
> > (albeit a major one) is that the compiler cannot enforce it.
> > 
> 
> Uh, wouldn't that restriction also make this non-standard-conforming?
> 	FORALL ( I = 2:N-1 )
> 	  A(I) = A(I) * 2		! S1
> 	  B(I) = A(I-1) + A(I+1)	! S2
> 	END FORALL
> A(I) in S1 is read by S2 on different iterations...
> 

Yes, this would be non-standard conforming.  In my not-too-careful reading
of Marc's proposal I had missed that S1 completes before S2 starts.  If you
take my restriction to consider only single statements within a FORALL loop
at a time, it probably works.  But you're right, it has to be carefully 
worded.

> Does that mean you can do a good job on this?
>	X = 0.0
>	FORALL ( I = 1:N )
>	  IF (A(I) = 0.0) THEN
>	    GOTO 100
>	  END IF
>	END FORALL
>	X = 1.0
> 100	PRINT X
> While we're on the subject, what's printed?

Ahhh,  your question states:

> Which of the following statements should be allowed in a block FORALL?

which I read to mean "within".  In my opinion,  GOTO's should be allowed 
only within the bounds of the FORALL block, not arbitrarily in or out, 
otherwise they have the same problem as STOP and PAUSE.  In other words,
a FORALL must be entered through the FORALL header and exited via the END
FORALL.

							Andy

---

From: [email-masked] (Min-You Wu)
Date: Thu, 25 Jun 92 23:12:20 EDT

> Let me observe that function calls have essentially all the problems
> that CALL statements do within FORALLs.  I want to be able to say
> 	FORALL ( I = 1:N ) A(I) = SIN( 2*I*PI / N )
> but be protected from suprises in
> 	FORALL ( I = 1:N ) A(I) = MESSY_FUNCTION( I, B(I), INDX(:) )
> where MESSY_FUNCTION could potentially 
> 	Assign to B(I) [ no problem, they're independent ]
> 	Assign to B(INDX(I)) [ big problem, in general ]
> 	Reference all of INDX [ possibly complicated if INDX is distributed ]
> 	Assign anything in INDX [ big problem ]

Could you write a MESSY_FUNCTION to include all of this cases?

Min-You