Boundary checking doesn’t work with cray pointers.
module m
real :: A(8)
real*8 :: B(:)
contains
subroutine init
pointer (pB,B)
pB = LOC(A)
end
end
program P
use m
A(2)=pi
print*, B(2)
end
This code, if compiled with -C flag, produces output:
fenixk19@fenixk19-desktop /tmp> pgf95 -C cray_test.f95
fenixk19@fenixk19-desktop /tmp> ./a.out
0: Subscript out of range for array b (cray_test.f95: 15)
subscript=2, lower bound=0, upper bound=-1, dimension=1
fenixk19@fenixk19-desktop /tmp>
Is that bug? Or it is ok? If so, what is the right way to work with data of different types, but placed in same memory?