re PR fortran/44211 ([OOP] ICE with TBP of pointer component of derived type array)
authorJanus Weil <janus@gcc.gnu.org>
Wed, 9 Jun 2010 14:14:08 +0000 (16:14 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 9 Jun 2010 14:14:08 +0000 (16:14 +0200)
2010-06-09  Janus Weil  <janus@gcc.gnu.org>

PR fortran/44211
* resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
Resolve references.

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

PR fortran/44211
* gfortran.dg/typebound_call_14.f03: New test.

From-SVN: r160478

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

index a19f9c6c57d6b0c3a5a2fd5bb26ec54752c594ab..e1faa4d9fdb397a0752c998c7cca270b0856accd 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-09  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/44211
+       * resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
+       Resolve references.
+
 2010-06-09  Kai Tietz  <kai.tietz@onevision.com>
 
        * resolve.c (resolve_deallocate_expr): Avoid warning
index 2ee82afbe5acbac71c88b901b7a7b4045dcc14d6..8fabf4e69b743566794b78abc1b36d3b50bb118f 100644 (file)
@@ -5415,6 +5415,9 @@ resolve_typebound_function (gfc_expr* e)
   if (st == NULL)
     return resolve_compcall (e, NULL);
 
+  if (resolve_ref (e) == FAILURE)
+    return FAILURE;
+
   /* Get the CLASS declared type.  */
   declared = get_declared_from_expr (&class_ref, &new_ref, e);
 
@@ -5487,6 +5490,9 @@ resolve_typebound_subroutine (gfc_code *code)
   if (st == NULL)
     return resolve_typebound_call (code, NULL);
 
+  if (resolve_ref (code->expr1) == FAILURE)
+    return FAILURE;
+
   /* Get the CLASS declared type.  */
   declared = get_declared_from_expr (&class_ref, &new_ref, code->expr1);
 
index 6d4b6f19a00a3d9328b76be55be9e716a37a4974..560e6a47e94204e481442a322ab3220940d79d32 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-09  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/44211
+       * gfortran.dg/typebound_call_14.f03: New test.
+
 2010-06-09  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/44423
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_14.f03 b/gcc/testsuite/gfortran.dg/typebound_call_14.f03
new file mode 100644 (file)
index 0000000..e8cbf84
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR 44211: [OOP] ICE with TBP of pointer component of derived type array
+!
+! Original test case by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+module ice_module
+  type::ice_type
+     class(ice_type),pointer::next
+   contains
+     procedure::ice_sub
+     procedure::ice_fun
+  end type ice_type
+contains
+  subroutine ice_sub(this)
+    class(ice_type)::this
+  end subroutine
+  integer function ice_fun(this)
+    class(ice_type)::this
+  end function
+  subroutine ice()
+    type(ice_type),dimension(2)::ice_array
+    call ice_array(1)%next%ice_sub()
+    print *,ice_array(2)%next%ice_fun()
+  end subroutine
+end module ice_module
+
+! { dg-final { cleanup-modules "ice_module" } }