[J3] surprisingly PURE

Bill Long longb at cray.com
Sun Apr 19 16:03:52 EDT 2020

> On Apr 19, 2020, at 2:14 PM, Shterenlikht, Anton via J3 <j3 at mailman.j3-fortran.org> wrote:
>> On 19 Apr 2020, at 18:17, Steven G. Kargl via J3 <j3 at mailman.j3-fortran.org> wrote:
>> For Bob's code, it seems odd to me that the Fortran standard
>> would allow a variable available through host association in a
>> pure subprogram to be indirectly (re)defined by pointer association.
>> But, then again, I avoid the use of pointers in my own codes.
> "odd" is not the right word.
> As Bob said, "it should not be standard conformant",
> yet I also cannot see which constraint it violates.
> Interestingly of the 4 compilers I tried,
> 2 reject the pointer assignment in the derived type
> and 1 gives ICE!
> The 4th compiler accepts and outputs 2.0 at runtime.

If the PURE is removed, I would expect any compiler would create an a,out and running it would output 2. 


> Anton

Bill Long                                                                       longb at cray.com
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray, a Hewlett Packard Enterprise company/ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425

More information about the J3 mailing list