re PR fortran/46448 ([OOP] symbol `__copy_...' is already defined)
authorJanus Weil <janus@gcc.gnu.org>
Tue, 4 Jan 2011 12:59:23 +0000 (13:59 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Tue, 4 Jan 2011 12:59:23 +0000 (13:59 +0100)
2011-01-04  Janus Weil  <janus@gcc.gnu.org>

PR fortran/46448
* class.c (gfc_find_derived_vtab): Set the module field for the copying
routine to make sure it receives module name mangling.

2011-01-04  Janus Weil  <janus@gcc.gnu.org>

PR fortran/46448
* gfortran.dg/class_34.f90: New.

From-SVN: r168464

gcc/fortran/ChangeLog
gcc/fortran/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_34.f90 [new file with mode: 0644]

index 0150108..800fc3a 100644 (file)
@@ -1,3 +1,9 @@
+2011-01-04  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/46448
+       * class.c (gfc_find_derived_vtab): Set the module field for the copying
+       routine to make sure it receives module name mangling.
+
 2011-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        * gfortranspec.c (lang_specific_driver): Update copyright notice
index 5b6851b..7095d3e 100644 (file)
@@ -528,6 +528,8 @@ gfc_find_derived_vtab (gfc_symbol *derived)
                  sub_ns->proc_name = copy;
                  copy->attr.flavor = FL_PROCEDURE;
                  copy->attr.if_source = IFSRC_DECL;
+                 if (ns->proc_name->attr.flavor == FL_MODULE)
+                   copy->module = ns->proc_name->name;
                  gfc_set_sym_referenced (copy);
                  /* Set up formal arguments.  */
                  gfc_get_symbol ("src", sub_ns, &src);
index e697796..824479b 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-04  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/46448
+       * gfortran.dg/class_34.f90: New.
+
 2011-01-04  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        * gcc.dg/torture/builtin-cproj-1.c: On the __SPU__ target, do not
diff --git a/gcc/testsuite/gfortran.dg/class_34.f90 b/gcc/testsuite/gfortran.dg/class_34.f90
new file mode 100644 (file)
index 0000000..ecdb4dd
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! PR 46448: [4.6 Regression] [OOP] symbol `__copy_...' is already defined
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module m0
+  type :: t
+  end type
+end module 
+
+module m1
+  use m0
+  class(t), pointer :: c1
+end module
+
+module m2
+  use m0
+  class(t), pointer :: c2
+end module
+
+end
+
+! { dg-final { cleanup-modules "m0 m1 m2" } }