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


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