[J3] [EXTERNAL] Re: Changing address of an allocatable on assignment when shapes match

Steve Lionel steve at stevelionel.com
Sat Aug 24 21:04:38 EDT 2019


On 8/24/2019 8:56 PM, Malcolm Cohen via J3 wrote:
> Bill Long conjectures:
> >
> I suspect the real issue is that the original specification in an old 
> standard was not careful about including the list of conditions that 
> require deallocation, and the general scheme was to always deallocate, 
> and then allocate.
> This conjecture is mistaken.  There was never ever such a scheme, as 
> it would have been incompatible with Fortran 90/95 as stated in my 
> earlier message.

To elaborate (not that Malcolm often needs such), prior to F2003 there 
was no such thing as reallocation on intrinsic assignment - the 
expression was required to conform to the variable:

"An intrinsic assignment statement is an assignment statement where the 
shapes of variable and expr conform"

F95, 7.5.1.2

F2003 opened up the possibility that the variable and expr did not 
conform, and if so, a deallocate/reallocate was specified. Some 
compilers chose not to do this by default, as it would slow down 
F95-conforming code. I think that nowadays all of these compilers now do 
the check by default as users have come to expect it.

Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190824/9cd3943a/attachment-0001.html>


More information about the J3 mailing list