Bug 39844 - module whole-file checking disabled
Summary: module whole-file checking disabled
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P5 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-22 02:57 UTC by macius bat
Modified: 2009-04-22 06:44 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux
Target: x86_64-linux
Build: x86_64-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description macius bat 2009-04-22 02:57:48 UTC
program main
  use after
end program main
 
module after
end module after

this is allowed by the standard, I hope gfortran support this.
Comment 1 kargls 2009-04-22 03:35:41 UTC
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.
Comment 2 macius bat 2009-04-22 04:32:32 UTC
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?
Comment 3 kargls 2009-04-22 05:52:55 UTC
(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?


Comment 4 macius bat 2009-04-22 06:37:55 UTC
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 .
Comment 5 macius bat 2009-04-22 06:44:49 UTC
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.