[J3] please try running this program

Steidel, Jon L jon.l.steidel at intel.com
Mon Oct 24 22:13:56 UTC 2022


ifort, gfortran (11.2.0) and NAG (7.0) all print

2
2

when the “X”s are changed to “I”s, and the RETURN statement is removed.

-jon

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Robert Corbett via J3
Sent: Monday, October 24, 2022 7:20 AM
To: J3 List <j3 at j3-fortran.org>
Cc: Robert Corbett <rpcorbett at att.net>
Subject: [J3] please try running this program

      PROGRAM MAIN
        TYPE T
          INTEGER(KIND(X)) Y
        END TYPE T
        CALL SUBR1
        RETURN
      CONTAINS
        SUBROUTINE SUBR1
          X = 1
          CALL SUBR2
          PRINT *, X
        END SUBROUTINE SUBR1
        SUBROUTINE SUBR2
          X = 2
          PRINT *, X
        END SUBROUTINE SUBR2
      END

The scope rules for implicit declarations
between Fortran 2008 with Corrigendum 1
and Fortran 2018.  This program determines
which scope rules are used.

Robert Corbett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221024/9afebe52/attachment.htm>


More information about the J3 mailing list