program main use after end program main module after end module after this is allowed by the standard, I hope gfortran support this.
Are you sure? The module after must be available when "use after" has been reached. Can you cite the relevant part of the standard that supports your claim.
no quite. but the std post on limitation on this , so I really hope gfortran support it. http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/f4ab93c7cece56ee/d4518a395a0fd4fe?hl=zh-CN#d4518a395a0fd4fe today I check the Changelog ,I found * resolve.c (resolve_global_procedure): Enable whole-file checking for procedures that are declared later in the file. so I post this to gcc bugzilla. can the developers think about this?
(In reply to comment #2) > no quite. > but the std post on limitation on this , so I really hope gfortran support it. > > http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/f4ab93c7cece56ee/d4518a395a0fd4fe?hl=zh-CN#d4518a395a0fd4fe > > today I check the Changelog ,I found > * resolve.c (resolve_global_procedure): Enable whole-file checking for > procedures that are declared later in the file. > > so I post this to gcc bugzilla. > > can the developers think about this? > Given the URL you posted, I'm inclined to say this should be closed with WONTFIX. It is a clear violation of the standard: Note 2.2 in F2003 states: This standard places no ordering requirement on the program units that constitute a program, butmbecause the public portions of a module are required to be available by the time a module reference (11.2.1) is processed, a processor may require a particular order of processing of the program units. In 11.2.1, one finds The USE statement specifies use association. A USE statement is a module reference to the module it specifies. At the time a USE statement is processed, the public portions of the specified module shall be available. When the USE AFTER is processed, the public is not available. period. Is really that difficult to re-order the code? In particular, how many other compiler accept your code?
in my opiton of view , at the time a USE statement is processed, the public portions of the specified module shall be available. should not been think as about the order of units, since "This standard places no ordering requirement on the program units". it should been think as the time order how compiler processes the program units. if it is somewhat vague to say this is a bug( I do think so), OK, let's be an advice of me .
of cource it is not difficult to reorder the source . I don't know any compiler can do this, I wish there are a outsmart one.