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/46313] [OOP] class container naming collisions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46313

--- Comment #20 from janus at gcc dot gnu.org 2011-01-07 12:58:07 UTC ---
(In reply to comment #19)
> In the dump you can see that we end up with one vtab for both types.

This is easily fixed by putting the first letter of the derived type name in
upper case:


Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 168565)
+++ gcc/fortran/class.c (working copy)
@@ -116,13 +116,16 @@

 static void
 get_unique_type_string (char *string, gfc_symbol *derived)
-{  
+{
+  char dt_name[GFC_MAX_SYMBOL_LEN+1];
+  sprintf (dt_name, "%s", derived->name);
+  dt_name[0] = TOUPPER (dt_name[0]);
   if (derived->module)
-    sprintf (string, "%s_%s", derived->module, derived->name);
+    sprintf (string, "%s_%s", derived->module, dt_name);
   else if (derived->ns->proc_name)
-    sprintf (string, "%s_%s", derived->ns->proc_name->name, derived->name);
+    sprintf (string, "%s_%s", derived->ns->proc_name->name, dt_name);
   else
-    sprintf (string, "_%s", derived->name);
+    sprintf (string, "_%s", dt_name);
 }


For a proper runtime test case, one could just add a call to
"same_type_as(a1,a2)" to comment #19.


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