Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

lbound and ubound

Mike_Z_
Novice
277 Views

I transfer to the following subroutine array C as argument with bounds (0:450):

subroutine A(B,C)
real*8 B, C(:)
integer LB, UB
...
LB=lbound(C)
UB=ubound(C)
...
end subroutine A

But in fact, lb=1, and ub=451.

What's wrong? I suspect myself...

 

0 Kudos
2 Replies
Steven_L_Intel1
Employee
277 Views

That's the definition in the standard. Think about what LBOUND and UBOUND might be if you passed C([2,17.24,6]) or C(4:45:3). Unless the dummy argument is a pointer and you pass a pointer, LBOUND will always be 1 and UBOUND always the extent of the associated actual argument. (Unless you specify a different lower bound on the dummy, of course.)

0 Kudos
Mike_Z_
Novice
277 Views

Thank you, Steve!

0 Kudos
Reply