This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

default return value of ubound and lbound


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]