This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46313] [OOP] class container naming collisions
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 7 Jan 2011 12:58:24 +0000
- Subject: [Bug fortran/46313] [OOP] class container naming collisions
- Auto-submitted: auto-generated
- References: <bug-46313-4@http.gcc.gnu.org/bugzilla/>
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.