------- Additional Comments From sgk at troutmask dot apl dot washington dot 
edu  2005-08-06 16:03 -------
Subject: Re:  gfortran .f90 complex parameter initialization syntax bug

On Sat, Aug 06, 2005 at 03:02:37PM -0000, christopherbuell at mindspring dot 
com wrote:
> 
> (In reply to comment #3)
> 
> Got it. I don't know the F90 or F95 standard very well.

The Standard can be tricky to read.  I have a draft of
F2003 here so I'll quote that

7.1.7     Initialization expression
An initialization expression is an expression with limitations that
make it suitable for use as a kind type parameter, initializer, or
named constant.  It is an expression in which each operation is
intrinsic, and each primary is
      (1)      A constant or subobject of a constant,
      (2)-(11) Don't apply.

real, parameter    :: x = -1.e0         ! Uses a constant.
complex, parameter :: z = (1.e0, -1.e0) ! Uses constants.
complex, parameter :: c = (x,-x)        ! x is a named constant, -x is not.

You probably found a vendor extension, because -x could be
evaluated at compile time.

If you really want to sit and puzzle over the standard.  Consider

program c
   real, parameter :: o = 1.e0
   real, parameter :: t = 2.e0
   real, parameter :: h = o / t           ! This is ok.
   complex, parameter :: z = (o / t, h)   ! This is not ok.
   print *, o, t, h
end program c




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23254

Reply via email to