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: "olchansk at panix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2004 04:39:01 -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 olchansk at panix dot com 2004-07-12 04:38 -------
This change to module.c::write_symbol0() fixes the symbol collisions. My project
now almost links, except for the missing "entry" symbols. Yay!
Something silly is going on. This is how I understand this problem (feel free to
laugh at me if I got it completly backwards). gfc_sym_mangled_function_id()
depends on sym->module to create unique mangled names. However, private module
subroutines arrive there with sym->module blank and mangling cannot happen. So,
who sets sym->module? The only place I could find is in
module.c::write_symbol(). Internal subroutines do not go through "write_symbol"
and their sym->module remains blank.
Fix to module.c::write_symbol0(): add lines marked "+" (no cvs diff this time,
sorry).
sym = st->n.sym;
if (sym->attr.flavor == FL_PROCEDURE && sym->attr.generic
&& !sym->attr.subroutine && !sym->attr.function)
return;
+ if (sym->attr.proc == PROC_MODULE && sym->module[0] == 0)
+ strcpy (sym->module, module_name);
if (!check_access (sym->attr.access, sym->ns->default_access))
return;
K.O.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16485