This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/16485] Private subroutines from different modules collide during linking.
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2004 12:37:32 -0000
- Subject: [Bug fortran/16485] Private subroutines from different modules collide during linking.
- References: <20040712004514.16485.olchansk@panix.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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