This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
default return value of ubound and lbound
- From: Maximilien Levesque <maximilien dot levesque at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Sat, 2 Jun 2012 21:05:32 +0200
- Subject: default return value of ubound and lbound
- References: <CAJdy7pJbZR3N3rw32owPM+DCDA6=2L38QyA0D3=r1AJ-S1rYWA@mail.gmail.com>
Dear all,
I hope I just not add noise with this mail, but I'd like to report
something about ubound and lbound.
Consider this simple test case :
program testcaseubound
? implicit none
? real,dimension(10) :: array
? integer :: i
? i= ubound(array)
end program testcaseubound
gfortran gives me a compilation error :
? i= ubound(array)
? 1
Error: Incompatible ranks 0 and 1 in assignment at (1)
while the following test case works as expected :
program testcaseuboundok
? implicit none
? real,dimension(10) :: array
? integer :: i
? i= ubound(array,1) ! ,1 added
end program testcaseuboundok
It seems to me that by default, without the DIM precision in ubound
(or lbound), the return value should be of kind integer.
I checked on bugzilla and did not find anything related. Hope I did
not miss something.
My compiler is
gfortran --version
GNU Fortran (GCC) 4.7.0 20120505 (prerelease)
I take this opportunity to thank you for your much appreciated work on
gfortran, which is used extensively in every science lab I've been
working for.
Max.