John Reid said:
> Jean Vezina wrote:
> > To all:
> >
> > Before sending a bug report, I would like to know if the following
> > example is standard conforming (Fortran 95):
> >
> > integer,parameter::v(3)=(/3,1,2/)
> > real x(3)
> > data (x(v(i)),i=1,3)/4.,6.,2./
> > print *,x
> > end
> >
>
> This is a tricky one that may call for an interpretation.
>
> 61:34-35 says:
>
> "Constraint: In a variable that is a data-stmt-object, any subscript, section
> subscript, substring starting point, and substring ending point shall be an
> initialization expression."
Sorry, but this reasoning is incorrect. (Just as well, because it would
have outlawed ALL data-implied-do subscripting!).
It is incorrect because this constraint does not apply to x(v(i)); this
is because x(v(i)) is a
<data-i-do-object>
not a
<data-stmt-object>
A <data-i-do-object> is subject to a different constraint [62:8-11],
which says that any subscript expression in a <data-i-do-object>
"shall involve as primaries only constants, subobjects of constants, or DO
variables of the containing <data-implied-do>s..."
Examining the primaries of v(i), there are two:
v(i) itself; this is a subobject of a constant, so satisfies the constraint
i; this is a data-implied-do variable, so satisfies the constraint
Therefore the example is standard-conforming.
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
________________________________________________________________________
|