From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2396 invoked by alias); 4 Dec 2009 23:28:23 -0000 Received: (qmail 2349 invoked by uid 48); 4 Dec 2009 23:28:07 -0000 Date: Fri, 04 Dec 2009 23:28:00 -0000 Message-ID: <20091204232807.2348.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/40973] Mark PRIVATE module functions as STATIC to faciliate optimization In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dfranke at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg00468.txt.bz2 ------- 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