This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [G95] External references



On Thursday 27 November 2003 2:19 pm, Tobias Schl?er wrote: > I'm forwarding this to the list, because I guess it might be of more > general interest :-) <snip> > | trymod.o: In function `MAIN__': > | trymod.o(.text+0x86): undefined reference to `__aaa__real_add' > | trymod.o(.text+0xa1): undefined reference to `__aaa__int_add'

This is PR13155.

For variables declared in a module, they should be referenced as "module name + variable name", but in module, only the interface of a subroutine or function is provided,its body can be defined in other file. When codes of function body are generating, compiler can not know wheter the function has expicit interface in a module. So, for subroutines or functions in module, they should be referenced as "subroutine/function name", "module name" need not be added.


Huang Chun

==========
*** trans-decl.c.old    Fri Nov 28 10:54:36 2003
--- trans-decl.c        Fri Nov 28 10:57:12 2003
*************** gfc_sym_mangled_function_id (gfc_symbol
*** 291,319 ****
   int has_underscore;
   char name[GFC_MAX_MANGLED_SYMBOL_LEN + 1];

!   if (sym->module[0] == 0 || sym->attr.proc == PROC_EXTERNAL)
!     {
!       if (strcmp (sym->name, "MAIN__") == 0
!         || sym->attr.proc == PROC_INTRINSIC)
!       return get_identifier (sym->name);

!       if (gfc_option.flag_underscoring)
!       {
!         has_underscore = strchr (sym->name, '_') != 0;
!         if (gfc_option.flag_second_underscore && has_underscore)
!           snprintf (name, sizeof name, "%s__", sym->name);
!         else
!           snprintf (name, sizeof name, "%s_", sym->name);
!         return get_identifier (name);
!       }
!       else
!       return get_identifier (sym->name);
!     }
!   else
     {
!       snprintf (name, sizeof name, "__%s__%s", sym->module, sym->name);
       return get_identifier (name);
       return get_identifier (name);
     }
 }


--- 291,311 ---- int has_underscore; char name[GFC_MAX_MANGLED_SYMBOL_LEN + 1];

!   if (strcmp (sym->name, "MAIN__") == 0
!       || sym->attr.proc == PROC_INTRINSIC)
!     return get_identifier (sym->name);

!   if (gfc_option.flag_underscoring)
     {
!       has_underscore = strchr (sym->name, '_') != 0;
!       if (gfc_option.flag_second_underscore && has_underscore)
!         snprintf (name, sizeof name, "%s__", sym->name);
!       else
!         snprintf (name, sizeof name, "%s_", sym->name);
       return get_identifier (name);
     }
+   else
+     return get_identifier (sym->name);
 }

_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn



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