(j3.2006) Reallocation and dangling pointers

Damian Rouson damian
Thu Apr 16 16:28:46 EDT 2015


> On Apr 16, 2015, at 1:16 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:
> 
> 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.

This would be a very helpful compiler warning. 

> 
> 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 people (especially more Fortran programmers) are likely to get the array shape correct ? especially given that we have a SHAPE intrinsic ? than are likely to get the pointer association status correct, which would argue for favoring pointer association status over array shape and dynamic type safety.  However, it has been a long road to try to get vendors to make automatic reallocation the default behavior and it still isn?t the default with at least two vendors of which I?m aware.  I?d hate to tweak the reallocation rules in a way that could break existing codes.  At least if the automatic reallocation feature remains stable, there might be hope that more vendors will conform to the standard by default.

Damian






More information about the J3 mailing list