(j3.2006) USE and BLOCK contructs
Robert Corbett
rpcorbett
Thu Oct 12 20:03:09 EDT 2017
While I disagree entirely with the discussion and proposed edits
in paper 17-184, there is a related issue I find concerning.
Consider the program
????? MODULE VAR
??????? REAL :: X = 1.0
????? END MODULE VAR
????? PROGRAM MAIN
??????? PRINT *, X
??????? A: BLOCK
????????? USE VAR
??????? END BLOCK A
????? END PROGRAM MAIN
The variable X is not explicitly declared in the BLOCK construct,
so it is a local identifier, not the name of a construct entity.
Therefore, its scope includes the scoping unit of the main program.
Therefore, the program appears to be conformant, and it should print
something like
?1.0
Was this intended?
The text of Fortran 2008 and the current Fortran 2015 draft are
consistent and seem clear on this point, but I still have doubts
that such a program was intended be conformant.
Robert Corbett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.j3-fortran.org/pipermail/j3/attachments/20171013/56fc9bfb/attachment.html>
More information about the J3
mailing list