bug? re: array dimensions

bug? re: array dimensions


I'm not a Fortran90 expert, so I don't know if the program below has an illegal declaration or if the compiler has a bug:

program test
integer, parameter, dimension(3) :: nxyz = 32
integer, parameter :: nx=2, ny=2, nz=2
real, parameter, dimension(3) :: xyz_range = (/ nx, ny, nz /)
real, parameter, dimension(3) :: b0 = nxyz*nxyz/xyz_range
end program

The compiler (Intel Fortran compiler 8.0 on RedHat 9) outputs:

fortcom: Error: ftest.f90, line 5: This operator is invalid in a constant expression evaluation.
real, parameter, dimension(3) :: b0 = nxyz*nxyz/xyz_range
compilation aborted for ftest.f90 (code 1)

Thanks in advance for your help.
--Israel Hsu

Message Edited by israelhsu on 01-21-2004 11:55 AM

Message Edited by israelhsu on 01-21-2004 12:01 PM

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

nxyz is an array - I don't think you wanted the dimension(3) on it's declaration.

Steve Lionel (Intel)'s picture

It's not clear to me what you want here. What do you expect the value of b0 to be?

Steve Lionel (Intel)'s picture

It seems that the compiler is objecting to the mixed integer-real array arithmetic here. This may be a bug, but my head is spinning trying to make sense of it. However, this works:

real, dimension(3), parameter :: b0 = real((nxyz * nxyz)) /xyz_range


Login to leave a comment.