OSDN Git Service

gcc/fortran/
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 Dec 2009 23:13:03 +0000 (23:13 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 Dec 2009 23:13:03 +0000 (23:13 +0000)
2009-12-28 Janus Weil  <janus@gcc.gnu.org>

PR fortran/42353
* symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private.

gcc/testsuite/
2009-12-28  Janus Weil  <janus@gcc.gnu.org>

PR fortran/42353
* gfortran.dg/class_13.f03: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155494 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_13.f03 [new file with mode: 0644]

index 0f2ecc7..55fc753 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-28 Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/42353
+       * symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private.
+
 2009-12-27  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Daniel Kraft  <d@domob.eu>
 
 2009-12-27  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Daniel Kraft  <d@domob.eu>
 
index 1b40d9a..8ba5adb 100644 (file)
@@ -4748,6 +4748,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
          vtab->attr.target = 1;
          vtab->attr.save = SAVE_EXPLICIT;
          vtab->attr.vtab = 1;
          vtab->attr.target = 1;
          vtab->attr.save = SAVE_EXPLICIT;
          vtab->attr.vtab = 1;
+         vtab->attr.access = ACCESS_PRIVATE;
          vtab->refs++;
          gfc_set_sym_referenced (vtab);
          sprintf (name, "vtype$%s", derived->name);
          vtab->refs++;
          gfc_set_sym_referenced (vtab);
          sprintf (name, "vtype$%s", derived->name);
@@ -4764,6 +4765,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
                return NULL;
              vtype->refs++;
              gfc_set_sym_referenced (vtype);
                return NULL;
              vtype->refs++;
              gfc_set_sym_referenced (vtype);
+             vtype->attr.access = ACCESS_PRIVATE;
 
              /* Add component '$hash'.  */
              if (gfc_add_component (vtype, "$hash", &c) == FAILURE)
 
              /* Add component '$hash'.  */
              if (gfc_add_component (vtype, "$hash", &c) == FAILURE)
index b92799f..aef38ad 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-28  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/42353
+       * gfortran.dg/class_13.f03: New test.
+
 2009-12-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR middle-end/41344
 2009-12-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR middle-end/41344
diff --git a/gcc/testsuite/gfortran.dg/class_13.f03 b/gcc/testsuite/gfortran.dg/class_13.f03
new file mode 100644 (file)
index 0000000..84073bf
--- /dev/null
@@ -0,0 +1,37 @@
+! { dg-do compile }
+!
+! PR 42353: [OOP] Bogus Error: Name 'vtype$...' at (1) is an ambiguous reference ...
+!
+! Original test case by Harald Anlauf <anlauf@gmx.de>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+module concrete_vector
+  type :: trivial_vector_type
+  end type
+  class(trivial_vector_type), pointer :: this
+end module concrete_vector
+
+module concrete_gradient
+contains
+  subroutine my_to_vector (v)
+    use concrete_vector
+    class(trivial_vector_type) :: v
+    select type (v)
+    class is (trivial_vector_type)
+    end select
+  end subroutine
+end module concrete_gradient
+
+module concrete_inner_product
+  use concrete_vector
+  use concrete_gradient
+contains
+  real function my_dot_v_v (a)
+    class(trivial_vector_type) :: a
+    select type (a)
+    class is (trivial_vector_type)
+    end select
+  end function
+end module concrete_inner_product
+! { dg-final { cleanup-modules "concrete_vector concrete_gradient concrete_inner_product" } }