gfortran seems to miscalculate the rank when trying to get a component of an array member of a derived type parameter. I think that the following program explains better than my cryptic explanations :
program test_vec implicit none integer :: i real :: x type vec3 real, dimension(3) :: coords end type vec3 type(vec3),parameter :: v1 = vec3((/ 1.0, 2.0, 3.0 /)) type(vec3) :: v2 v2 = vec3((/ 1.0, 2.0, 3.0 /)) x = v1%coords(1) ! works do i=1,3 x = v1%coords(i) ! fails x = v2%coords(i) ! works end do end program test_vec Here is the error returned ... $ gfortran -c test.f test.f:27.9: x = v1%coords(i) ! fails 1 Error: Incompatible ranks 0 and 1 in assignment at (1) ... and the version of gfortran used : $ gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-svn/gcc/configure --enable-languages=fortran : (reconfigured) ../gcc-svn/gcc/configure --enable-languages=fortran : (reconfigured) ../gcc-svn/gcc/configure --enable-languages=fortran Thread model: posix gcc version 4.3.0 20070926 (experimental) (GCC) -- Summary: fortran : wrong rank of derived type parameters array components Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mikael dot morin at tele2 dot fr GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33566