[4.1.2] star, column and "Error: The upper bound in the last dimension..."
EatDirt
dirteat@gmail.com
Wed May 9 16:20:00 GMT 2007
Hi,
Apologizes if this is noise, but I have been confused during a while by
this compilation error message in a quite large piece of code:
"Error: The upper bound in the last dimension of the assumed_size array
on the rhs of the pointer assignment at (1) must be set"
obtained with
GNU Fortran 95 (GCC) 4.1.2 20070302 (prerelease) (4.1.2-1mdv2007.1)
(mandriva embedded)
The error context can be reproduced with this little piece of code and
is actually triggered by using the "*" for the automatic array
declaration instead of the standard ":". I did not fill a bug report
since the solution is nearly trivial and using f77-like declaration in
f90 source is never a good idea :) However, all the other compilers I
tried do not complain on this and the error message is quite tricky to
find that the bloody "*" should not be there!
-------------------------------------------------------------------------
program starcolumn
implicit none
type ptarr
real, pointer :: pt => null()
end type ptarr
type(ptarr), dimension(2) :: myArr
call my_routine(myArr)
contains
subroutine my_routine(dummyArr)
implicit none
type(ptarr), dimension(*) :: dummyArr
dummyArr(1)%pt => dummyArr(2)%pt
end subroutine my_routine
end program starcolumn
-------------------------------------------------------------------------
At compilation:
gfortran starcolumn.f90
In file starcolumn.f90:20
dummyArr(1)%pt => dummyArr(2)%pt
1
Error: The upper bound in the last dimension of the assumed_size array
on the rhs of the pointer assignment at (1) must be set
The same code with
type(ptarr), dimension(:) :: dummyArr
instead of
type(ptarr), dimension(*) :: dummyArr
works fine.
All the best,
Chris.
More information about the Fortran
mailing list