QUERY regarding FORALL construct

Paul Brook paul@codesourcery.com
Mon Sep 26 13:50:00 GMT 2005


On Monday 26 September 2005 08:15, Sudesh Chandna, Noida wrote:
> Hi,
>
> I have a doubt in FORALL construct when there is a scalar assignment
> statement in FORALL body. Consider following example:
>
> Program main
> Implicit none
> Integer::a,i
>
> Forall (i=1:10)
>             a=a+1
> endforall
> print *,a
> end

This is illegal, so the compiler can do whatever it wants.
In this case gfortran correctly diagnoses the error at compile time.

Section 7.5.4.4:
"A many-to-one assignment is more than one assignment to the same object [...]
A many to one assignment shall not occur within a single statement in a FORALL 
construct or statement."

Paul



More information about the Fortran mailing list