(j3.2006) Reallocation and dangling pointers
Thu Apr 16 16:16:58 EDT 2015
Tom mentioned the case of an allocatable target being reallocated during
intrinsic assignment to a whole array, thereby undefining pointers
associated with it. The same problem occurs if the variable is
polymorphic, no matter whether it's a scalar or an array.
Processors could warn that this might happen, either at a declaration
where a variable gets both the ALLOCATABLE and TARGET attributes, or at
assignments where the reallocation might occur.
We could in principle revise the standard to turn off automatic
reallocation if the variable has the TARGET attribute. Do we favor
array shape and dynamic type safety more, or do we favor pointer
association status more?
More information about the J3