A couple of issues
Steve Kargl
sgk@troutmask.apl.washington.edu
Thu Feb 1 01:22:00 GMT 2007
On Wed, Jan 31, 2007 at 05:03:54PM -0800, Brooks Moses wrote:
> 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.
You're probably right. I was too tired (ok lazy) to think through
whether (4) or (5) applied. :)
> 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.
Some (or maybe even all) of the intrinsics list (5) are not
specifically testing in intrinsic.c(gfc_intrinsic_func_interface).
I suspect gfortran a bug with more than just RESHAPE.
> (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.)
This is definitely a bug under -std=2003. gfc_intrinsic_func_interface
hasn't changed for at least 3 years, which is as far back as svn log
goes.
--
Steve
More information about the Fortran
mailing list