If you want b to point to a(ilower:iupper) such that the bounds of b also run from ilower to iupper, the statement you want is
b(ilower:)=>a(ilower:iupper)
This form of pointer was not a part of Fortran 90 or Fortran 95; it was introduced in Fortran 2003. I assume that by now it is implemented in ifort. If you have to be compatible with a Fortran compiler that doesn't implement this form of pointer assignment, there is an ugly workaround:
call my_section_assigner(b,a(jlower:jupper),jlower)
...
subroutine my_section_assigner(lhs,rhs,lower)
integer :: lower
integer,pointer :: lhs(:)
integer,target :: rhs(lower:)
lhs=>rhs
end subroutine
The subroutine dummy argument rhs is associated with (i.e., points to) the section of interest, and the subroutine interface gives it our chosen lower bound. Because the pointer assignment is now to a simple name rather than an expression, the lower bound of that name becomes the lower bound of the pointer.
-Kurt
If you want b to point to a(ilower:iupper) such that the bounds of b also run from ilower to iupper, the statement you want is
b(ilower:)=>a(ilower:iupper)
This form of pointer was not a part of Fortran 90 or Fortran 95; it was introduced in Fortran 2003. I assume that by now it is implemented in ifort. If you have to be compatible with a Fortran compiler that doesn't implement this form of pointer assignment, there is an ugly workaround:
call my_section_assigner(b,a(jlower:jupper),jlower)
...
subroutine my_section_assigner(lhs,rhs,lower)
integer :: lower
integer,pointer :: lhs(:)
integer,target :: rhs(lower:)
lhs=>rhs
end subroutine
The subroutine dummy argument rhs is associated with (i.e., points to) the section of interest, and the subroutine interface gives it our chosen lower bound. Because the pointer assignment is now to a simple name rather than an expression, the lower bound of that name becomes the lower bound of the pointer.
-Kurt