I have a function with an allocatable return value, an by mistake I used it in an assignment statement of an explicit shape array. It took me some time figure out what had gone wrong, as the explicit shape array had dimensions that did't depart too much from the array returned by the function and the result was therefore just a rearrangement of the values. As the interface of allocatable functions must be explicit I guess that it is possible for the compiler to pick up that the allocatable function result is assigned to a "static" array, and at least give a warning about unsafe use..?
I don't know if this behavior is permitted by the standard or not, can anyone elaborate on that?
Also, when the array being assigned by the allocatable function actually is ALLOCATABLE, the array descriptor is passed along with the reference(?) to the data, and so the bounds will be correct (even if the lower bound(s) is(are) not 1). Is there any way to get the same behavior for non-deferred-shape-arrays? This question would also pertain to dummy arguments, ie. possible to have deferred-shape instead of assumed-shape for non-allocatable and non-pointer arguments without passing the (lower) bounds explicitly?