]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/45674 ([OOP] Undefined references for extended types)
authorJanus Weil <janus@gcc.gnu.org>
Thu, 16 Sep 2010 13:12:59 +0000 (15:12 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Thu, 16 Sep 2010 13:12:59 +0000 (15:12 +0200)
2010-09-16  Janus Weil  <janus@gcc.gnu.org>

PR fortran/45674
* interface.c (compare_parameter): Create vtab for actual argument,
instead of formal (if needed).

2010-09-16  Janus Weil  <janus@gcc.gnu.org>

PR fortran/45674
* gfortran.dg/class_dummy_2.f03: New.

From-SVN: r164338

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

index 10e4ce21423b79d4d63a56b6f3965601a9f69897..e8fe091e4d7efe1616f0aaf10b663a15cd9b786f 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-16  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/45674
+       * interface.c (compare_parameter): Create vtab for actual argument,
+       instead of formal (if needed).
+
 2010-09-15  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/45577
index e9d310a24443dee0735490e3a51749ae16a84b71..044ccd639f28cd908aa5a8b3e26ca8f7d82c51a7 100644 (file)
@@ -1428,10 +1428,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
       && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c)
     return 1;
 
-  if (formal->ts.type == BT_CLASS)
+  if (formal->ts.type == BT_CLASS && actual->ts.type == BT_DERIVED)
     /* Make sure the vtab symbol is present when
        the module variables are generated.  */
-    gfc_find_derived_vtab (formal->ts.u.derived);
+    gfc_find_derived_vtab (actual->ts.u.derived);
 
   if (actual->ts.type == BT_PROCEDURE)
     {
index 8baa140bad355ba73d24b3bbd9ba004289b30dc3..163079a253b2dad0fac863bc850a1b10734d40ef 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-16  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/45674
+       * gfortran.dg/class_dummy_2.f03: New.
+
 2010-09-16  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/45623
diff --git a/gcc/testsuite/gfortran.dg/class_dummy_2.f03 b/gcc/testsuite/gfortran.dg/class_dummy_2.f03
new file mode 100644 (file)
index 0000000..c173582
--- /dev/null
@@ -0,0 +1,33 @@
+! { dg-do run }
+!
+! PR 45674: [OOP] Undefined references for extended types
+!
+! Contributed by Dietmar Ebner <dietmar.ebner@gmail.com>
+
+module fails_mod
+  implicit none 
+  type :: a_t
+     integer :: a
+  end type
+  type, extends(a_t) :: b_t
+     integer :: b
+  end type
+contains
+  subroutine foo(a)
+    class(a_t) :: a
+  end subroutine foo
+end module fails_mod
+
+module fails_test
+  implicit none
+contains
+  subroutine bar
+    use fails_mod
+    type(b_t) :: b
+    call foo(b)
+  end subroutine bar
+end module fails_test
+
+end
+
+! { dg-final { cleanup-modules "fails_mod fails_test" } }
This page took 0.1095 seconds and 5 git commands to generate.