(j3.2006) Change from Fortran 2003 to Fortran 2008

Robert Corbett robert.corbett
Fri May 18 04:14:37 EDT 2012


The change in the definition of variables in Fortran 2008
appears to cause a semantic difference.  Consider the
program

       FUNCTION F(P)
         POINTER F, P
         F => P
       END

       PROGRAM ASSOC
         TARGET X
         POINTER P
         INTERFACE
           FUNCTION F(P)
             POINTER F, P
           END FUNCTION
         END INTERFACE
         X = 1.0
         ASSOCIATE(Y => F(P))
           X = 2.0
           PRINT *, X, Y
         END ASSOCIATE
       END

In Fortran 2003, the selector in the ASSOCIATE statement is
not a variable, and so the assignment to X does not affect
the value of Y.  In Fortran 2008, the selector is a variable,
and so the assignment to X should change the value of Y.

Robert Corbett



More information about the J3 mailing list