diff options
author | Janus Weil <janus@gcc.gnu.org> | 2011-01-09 11:35:50 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2011-01-09 11:35:50 +0100 |
commit | b52956be02218c3fda87f05f821e971879df83e5 (patch) | |
tree | 1a2c9c20a1d34da10396da7173a04d9096157eea /gcc | |
parent | 4ee1aa2a94b7c9aa0fa53957b51bbc6493279de8 (diff) | |
download | gcc-b52956be02218c3fda87f05f821e971879df83e5.zip gcc-b52956be02218c3fda87f05f821e971879df83e5.tar.gz gcc-b52956be02218c3fda87f05f821e971879df83e5.tar.bz2 |
re PR fortran/46313 ([OOP] class container naming collisions)
2011-01-09 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-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/46313
* gfortran.dg/class_35.f90: New.
From-SVN: r168610
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/class.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/class_35.f90 | 26 |
4 files changed, 44 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b65a21f..bc9738a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-01-09 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 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46405 diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index d07df87..2227f9e 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3977786..97d5ce4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-09 Janus Weil <janus@gcc.gnu.org> + + PR fortran/46313 + * gfortran.dg/class_35.f90: New. + 2011-01-08 Iain Sandoe <iains@gcc.gnu.org> * objc.dg/foreach-1.m: Add "-Wall" to flags. diff --git a/gcc/testsuite/gfortran.dg/class_35.f90 b/gcc/testsuite/gfortran.dg/class_35.f90 new file mode 100644 index 0000000..1b5502a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_35.f90 @@ -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" } } |