(j3.2006) Reallocation and dangling pointers
Thu Apr 16 16:26:58 EDT 2015
On Apr 16, 2015, at 4:16 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:
> 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?
This change would break ?many? existing codes.
I think Malcolm?s points about the availability of workarounds settles this matter from my pov. My job now becomes to convince all the vendors to implement the equivalent of -C=dangle. :-)
> J3 mailing list
> J3 at mailman.j3-fortran.org
Thomas Clune, Ph. D. <Thomas.L.Clune at nasa.gov>
Head ASTG,Code 606
MS 610.8 B33-C128
Greenbelt, MD 20771
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3