From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32068 invoked by alias); 12 Jul 2004 12:37:33 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 32047 invoked by uid 48); 12 Jul 2004 12:37:32 -0000 Date: Mon, 12 Jul 2004 12:37:00 -0000 Message-ID: <20040712123732.32046.qmail@sourceware.org> From: "tobi at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040712004514.16485.olchansk@panix.com> References: <20040712004514.16485.olchansk@panix.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug fortran/16485] Private subroutines from different modules collide during linking. X-Bugzilla-Reason: CC X-SW-Source: 2004-07/txt/msg01285.txt.bz2 List-Id: ------- Additional Comments From tobi at gcc dot gnu dot org 2004-07-12 12:37 ------- There's another problem: splitting your testcase in two files gives an error at link time. I don't think there's any reason a private procedure should have global linkage. (Mangling names would help for this, but linking large projects would definitely be sped up by not creating these global symbols in the first place). [tobi@marktplatz tests]$ cat pr16485.f90 module foo private contains subroutine sub end subroutine sub end module foo [tobi@marktplatz tests]$ cat pr16485_2.f90 module bar private contains subroutine sub end subroutine sub end module bar end [tobi@marktplatz tests]$ gfortran pr16485.f90 pr16485_2.f90 /tmp/ccadlrBF.o(.text+0x0): In function `sub_': : multiple definition of `sub_' /tmp/ccWqd9At.o(.text+0x0): first defined here collect2: ld returned 1 exit status [tobi@marktplatz tests]$ The error message is also remarkably bad. Compiling and linking in separate steps fixes that: [tobi@marktplatz tests]$ gfortran pr16485.f90 -c [tobi@marktplatz tests]$ gfortran pr16485_2.f90 -c [tobi@marktplatz tests]$ gfortran pr16485.o pr16485_2.o pr16485_2.o(.text+0x0): In function `sub_': : multiple definition of `sub_' pr16485.o(.text+0x0): first defined here collect2: ld returned 1 exit status [tobi@marktplatz tests]$ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16485