aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2010-09-16 15:12:59 +0200
committerJanus Weil <janus@gcc.gnu.org>2010-09-16 15:12:59 +0200
commit7d58b9e77aab0f4c8cd8f6eb4dc618b240325099 (patch)
tree435a44ae62bf4f462d5ee511ab9e305693e9e1bb /gcc
parentf941c3e2122d574412d351c69ddb634c2260683d (diff)
downloadgcc-7d58b9e77aab0f4c8cd8f6eb4dc618b240325099.zip
gcc-7d58b9e77aab0f4c8cd8f6eb4dc618b240325099.tar.gz
gcc-7d58b9e77aab0f4c8cd8f6eb4dc618b240325099.tar.bz2
re PR fortran/45674 ([OOP] Undefined references for extended types)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/interface.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/class_dummy_2.f0333
4 files changed, 46 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 10e4ce21..e8fe091 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index e9d310a..044ccd6 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -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)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8baa140..163079a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..c173582
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_dummy_2.f03
@@ -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" } }