A couple of issues
Brooks Moses
bmoses@stanford.edu
Thu Feb 1 01:04:00 GMT 2007
On Wed, Jan 31, 2007 at 04:41:06PM -0800, Steve Kargl wrote:
> On Wed, Jan 31, 2007 at 05:41:46PM +0000, Ignacio Fern?ndez Galv?n wrote:
> > The second thing, is that, compiling with -std=f95 or -std=f2003, I get
> > this error:
> >
> > Bij=RESHAPE((/ 1.0D0,3.0D0,3.0D0, &
> > 1
> > Error: Extension: Evaluation of nonstandard initialization expression
> > at (1)
> >
> > but nothing for Aij. It works fine with -std=gnu or -std=legacy. Is
> > there something in the standard preventing "reshape" for real variables
> > and alowing it for integers?
>
> In Fortran 95, only a select few intrinsic procedures are allowed
> in an initialization expression. RESHAPE with real arrays may not be
> one of those, so you get the Error: with -std=f95. I'm not sure what
> restrictions if any that Fortran 2003 may place on RESHAPE. RESHAPE
> with integer arrays works because it is allowed by the standard. See
> page 94 of the Fortran 95 standard.
Page 94, lines 9-11 (clause 5) is the relevant quote. It makes no
distinction between real and integer arrays with regards to
transformational intrinsics such as RESHAPE. The distinction between
real and integer arguments applies only to the elemental intrinsics in
clause 4, which are a different matter.
The Fortran 2003 standard, section 7.1.7, has essentially the same
provisions, except that it removes the restriction of elemental
intrinsics to only integer or character arguments, and thus allows real
and complex arguments as well.
This is thus a bug in gfortran; the given syntax should be allowed at
-std=f95 and -std=f2003.
(Also, if the real-vs.-integer distinction is being made at -std=2003,
we may have another bug for the elemental intrinsics. Unfortunately,
I'm away from a computer where I could check that.)
- Brooks
More information about the Fortran
mailing list