(j3.2006) Clarify F08/0147 ?

Cohen Malcolm malcolm
Thu Nov 12 03:17:17 EST 2015

Hi Bill,

Your understanding (1) and (2) is the same as mine.  For (3), I would word 
it as
  "For a defined assignment statement, auto-reallocation of allocatables 
does not occur, as that is only done by an intrinsic assignment statement."

How about adding the following extra paragraph to the answer?

  "With these edits, both of the statements A and B are defined assignment 
statements.  Auto-reallocation of allocatable variables only occurs as part 
of an intrinsic assignment statement, so while statement A is conforming 
(because the shapes are the same), statement B is not conforming (because 
the shapes differ)."


-----Original Message----- 
From: Bill Long
Sent: Wednesday, November 4, 2015 7:08 AM
To: fortran standards email list for J3
Subject: (j3.2006) Clarify F08/0147 ?

In working through the test case in Interp F08/0147, I think I understand 
the change, but the words I was looking for are not part of the answer.  The 
test case is:

Module da_module
    Type t
      Real c
    End Type
    Interface Assignment(=)
      Module Procedure edasgn
    End Interface
    Elemental Subroutine edasgn(a,b)
      Class(t),Intent(Out) :: a
      Class(t),Intent(In) :: b
      a%c = -b%c
    End Subroutine
  End Module
  Program edatest
    Call test(10,10,13)
    Subroutine test(n,n2,m)
      Use da_module
      Type(t) :: x(n),z(m)
      Type(t),Allocatable :: y(:)
      x%c = [ (i,i=1,n) ]
      z%c = [ (i,i=1,m) ]
      y = x                        ! A
      Print 1,y
    1 Format(*(1X,F0.1,:))
      y = z                        ! B
      Print 1,y
    End Subroutine
  End Program

With the change made by the edits, it appears that

1) The assignment A is defined assignment and is conforming (from first 

2) The assignment B is not standard conforming, since the shapes are not the 
same (from second edit).

3) Effectively, auto-reallcation on assignment will not occur if the 
assignment is defined assignment and the subroutine is elemental (since the 
shapes already agree).

All of which is fine with me.


Bill Long 
longb at cray.com
Fortran Technical Support  &                                  voice: 
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

J3 mailing list
J3 at mailman.j3-fortran.org

This e-mail has been scanned for all viruses by Star.

........................Malcolm Cohen, Nihon NAG, Tokyo. 

More information about the J3 mailing list