This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/16485] Private subroutines from different modules collide during linking.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]