diff options
author | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-09 10:35:50 +0000 |
---|---|---|
committer | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-09 10:35:50 +0000 |
commit | cf25639386302ba6401b9fd891ef8f3dd62a1824 (patch) | |
tree | 1a2c9c20a1d34da10396da7173a04d9096157eea | |
parent | 7ac54e7158f13a07844f62cb665cebc022d7d8fa (diff) | |
download | gcc-cf25639386302ba6401b9fd891ef8f3dd62a1824.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168610 138bc75d-0d04-0410-961f-82ee72b054a4
-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 b65a21fc86b..bc9738a1beb 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 d07df87b088..2227f9e72f3 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 39777861bc5..97d5ce46298 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 00000000000..1b5502a7870 --- /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" } } |