- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
The compiler (Intel Fortran compiler 8.0 on RedHat 9) outputs:
Thanks in advance for your help.
--Israel Hsu
israel@cs.ucla.edu
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
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nxyz is an array - I don't think you wanted the dimension(3) on it's declaration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not clear to me what you want here. What do you expect the value of b0 to be?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page