This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/40973] Mark PRIVATE module functions as STATIC to faciliate optimization
- From: "dfranke at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2009 23:28:07 -0000
- Subject: [Bug fortran/40973] Mark PRIVATE module functions as STATIC to faciliate optimization
- References: <bug-40973-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from dfranke at gcc dot gnu dot org 2009-12-04 23:28 -------
How about this (somewhat constructed) example:
! interface module, file (a)
MODULE M
PRIVATE :: two
CONTAINS
SUBROUTINE one(a)
integer :: a
END SUBROUTINE one
integer FUNCTION two()
END FUNCTION two
END MODULE
! implementation, file (b)
SUBROUTINE one(a)
USE M
integer :: a
a = two()
END SUBROUTINE one
integer FUNCTION two()
two = 42
END FUNCTION two
! another user of the function, without using the interface module, file (c)
SUBROUTINE three(a)
integer :: a
a = two()
END SUBROUTINE three
I often use modules simply to provide interfaces for subroutines implemented in
other files and compiled into libraries, then distributing the interface
modules together with the library to avoid issues with .mod files of varying
compiler versions.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40973