[J3] possible IMPORT problem
Robert Corbett
rpcorbett at att.net
Mon May 24 20:38:25 UTC 2021
The semantics of the IMPORT statement might be broken.
Consider the program
SUBROUTINE SUBR
END
PROGRAM MAIN
CALL SUBR
CALL MYSUB
CONTAINS
SUBROUTINE MYSUB
IMPORT,NONE
CALL SUBR
END SUBROUTINE MYSUB
END
The program appears to be standard conformant.
The instances of the name SUBR are all global
identifiers. Global identifiers have program
scope. In particular, the instance of the
name SUBR in the inner subroutine MYSUB is
not host associated with the instance of the
name SUBR in the host scope. Therefore, the
IMPORT statement has no effect on the name
SUBR.
Because SUBR is not host associated in MYSUB,
the restrictions imposed by paragraph 5 of
subclause 19.5.1.4 of 18-007r1 do not apply.
Note that if subroutine SUBR had an
explicit binding label, the name SUBR would
be a local identifier and the IMPORT
statement would apply.
I found and tried to fix a similar problem
with the IMPORT statement and the BLOCK
construct in the Fortran 2018 standard.
I am embarrassed that I did not think of the
effects of global identifiers at that time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210524/93462223/attachment.htm>
More information about the J3
mailing list