I would like to preserve array bounds in associate block as:
integer a(2:4,2)
associate (b => a(:,1))
print *, lbound(b), ubound(b)
end associate
I expect the bounds of b is 2 and 4, but in fact they are 1 and 3. How to do this? Thanks in advance!
You are associating to a subarray, its boundaries always start at 1. Try
AFAIK you can not use the pointer remapping trick in
associateconstruct. Specifically: “If the selector is an array, the associating entity is an array with a lower bound for each dimension equal to the value of the intrinsic LBOUND(selector).“But you can of course use pointers