Hi,
I’m using a trial version of PGI Workstation 12.5, and I get some compiler errors in my code. I isolated the cause of one of them and I prepared a short code to demonstrate it. So, consider the following modules:
MODULE latt
IMPLICIT NONE
TYPE :: lattice
INTEGER :: ndim, vol, dim(3)
END TYPE lattice
INTEGER, PARAMETER :: l1 = 8
INTEGER, PARAMETER :: l2 = 8
INTEGER, PARAMETER :: l3 = 8
INTEGER, PARAMETER :: ldim(3) = [ l1,l2,l3 ]
INTEGER, PARAMETER :: lvol = l1*l2*l3
TYPE(lattice), PARAMETER :: cube = lattice(3, lvol, ldim)
END MODULE latt
MODULE lattfield
USE latt
IMPLICIT NONE
INTEGER, PARAMETER :: l(3) = cube%dim
TYPE :: field
REAL :: site(l(1),l(2),l(3)) = 0.
END TYPE field
END MODULE lattfield
Compiling them with “pgfortran -c”, I get the following error:
PGF90-S-0084-Illegal use of symbol site - array must have constant bounds in a derived type (test.f90: 28)
PGF90-S-0084-Illegal use of symbol site - must be a deferred shape array (test.f90: 28)
0 inform, 0 warnings, 2 severes, 0 fatal for lattfield
It’s as if the components of the derived type PARAMETER ‘cube’ are not recognized as constant values. Is this a bug of the compiler, or is it predicted in the Fortran standard? It compiles and behaves well with ifort and gfortran.
Thanks,
helvio