Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

bug? re: array dimensions

israelhsu
Beginner
627 Views
Hi,

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
israel@cs.ucla.edu

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

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

0 Kudos
3 Replies
Steven_L_Intel1
Employee
627 Views
nxyz is an array - I don't think you wanted the dimension(3) on it's declaration.
0 Kudos
Steven_L_Intel1
Employee
627 Views
It's not clear to me what you want here. What do you expect the value of b0 to be?
0 Kudos
Steven_L_Intel1
Employee
627 Views

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

0 Kudos
Reply