* [Patch, Fortran, OOP] PR 46313: class container naming collisions (once again)
@ 2011-01-08 18:34 Janus Weil
2011-01-09 12:23 ` Janus Weil
0 siblings, 1 reply; 2+ messages in thread
From: Janus Weil @ 2011-01-08 18:34 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
Hi all,
I plan to commit the attached patch as obvious, unless anyone objects.
It fixes another case of class container naming collisions (comment
#12/#19 in the PR). We had fixed a few such cases before, and I hope
there are not much more left ...
I am in the process of regtesting and will commit tomorrow if no one
objects until then.
Cheers,
Janus
2011-01-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/46313
* class.c (get_unique_type_string): Make type name start with upper
case letter.
2011-01-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/46313
* gfortran.dg/class_35.f90: New.
[-- Attachment #2: pr46313_round3.diff --]
[-- Type: text/x-diff, Size: 1555 bytes --]
Index: gcc/testsuite/gfortran.dg/class_35.f90
===================================================================
--- gcc/testsuite/gfortran.dg/class_35.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/class_35.f90 (revision 0)
@@ -0,0 +1,26 @@
+! { dg-do run }
+!
+! PR 46313: [OOP] class container naming collisions
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+module one
+ type two_three
+ end type
+end module
+
+module one_two
+ type three
+ end type
+end module
+
+use one
+use one_two
+class(two_three), allocatable :: a1
+class(three), allocatable :: a2
+
+if (same_type_as(a1,a2)) call abort()
+
+end
+
+! { dg-final { cleanup-modules "one one_two" } }
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 168586)
+++ gcc/fortran/class.c (working copy)
@@ -116,13 +116,16 @@ gfc_class_null_initializer (gfc_typespec *ts)
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);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, Fortran, OOP] PR 46313: class container naming collisions (once again)
2011-01-08 18:34 [Patch, Fortran, OOP] PR 46313: class container naming collisions (once again) Janus Weil
@ 2011-01-09 12:23 ` Janus Weil
0 siblings, 0 replies; 2+ messages in thread
From: Janus Weil @ 2011-01-09 12:23 UTC (permalink / raw)
To: gfortran, gcc-patches
> I plan to commit the attached patch as obvious, unless anyone objects.
> It fixes another case of class container naming collisions (comment
> #12/#19 in the PR). We had fixed a few such cases before, and I hope
> there are not much more left ...
Committed as r168610 after successful regstrap.
Cheers,
Janus
> 2011-01-08 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/46313
> * class.c (get_unique_type_string): Make type name start with upper
> case letter.
>
>
> 2011-01-08 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/46313
> * gfortran.dg/class_35.f90: New.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-09 10:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-08 18:34 [Patch, Fortran, OOP] PR 46313: class container naming collisions (once again) Janus Weil
2011-01-09 12:23 ` Janus Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).