public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dfranke at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/40973] Mark PRIVATE module functions as STATIC to faciliate optimization
Date: Fri, 04 Dec 2009 23:28:00 -0000	[thread overview]
Message-ID: <20091204232807.2348.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40973-13404@http.gcc.gnu.org/bugzilla/>



------- 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


  reply	other threads:[~2009-12-04 23:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05 16:09 [Bug fortran/40973] New: " burnus at gcc dot gnu dot org
2009-12-04 23:28 ` dfranke at gcc dot gnu dot org [this message]
2010-02-20 22:08 ` [Bug fortran/40973] " burnus at gcc dot gnu dot org
     [not found] <bug-40973-4@http.gcc.gnu.org/bugzilla/>
2012-04-03 15:25 ` burnus at gcc dot gnu.org
2012-04-08  7:15 ` burnus at gcc dot gnu.org
2012-04-08  8:07 ` burnus at gcc dot gnu.org
2012-04-15  5:53 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091204232807.2348.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).