Enhancements to allocatable arrays

@RonShepard

You are missing the main point, which is the fact that the standard currently requires contiguity for the allocacatable arrays. So the compiler knows for instance that such a call never requires a copy-in/copy-out:

real, allocatable :: a(:,:)
<some code>
call foo(a)
...
subroutine foo(x)
   real, contiguous :: x(:,:)

So, if the conguitity enforcement is removed for allocatables it will have negative consequences. Actually it will even break the backward compatibility:

implicit none
real, allocatable, target :: a(:,:)
real, pointer :: p(:)
allocate( a(100,100) )
p(1:200) => a
end

The above code is valid because a is guaranteed to be contiguous. If the contiguity constraint was removed, this code would become invalid.

So, your wishes requires something else than allocatable, such as a resizable attribute. Why not, but you have to make it clear.

1 Like