summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-17 22:15:30 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-17 22:15:30 +0000
commitd17bd57e7deb645f6208bcb754c632047d1e08d1 (patch)
treef98c004da20f46815426d886695c83b59079ca0a
parent231eb56b751788c2166221b6e04da6b2dea545fc (diff)
downloadppe42-gcc-d17bd57e7deb645f6208bcb754c632047d1e08d1.tar.gz
ppe42-gcc-d17bd57e7deb645f6208bcb754c632047d1e08d1.zip
2010-06-17 Janus Weil <janus@gcc.gnu.org>
PR fortran/44558 * resolve.c (resolve_typebound_function,resolve_typebound_subroutine): Return directly in case of an error. 2010-06-17 Janus Weil <janus@gcc.gnu.org> PR fortran/44558 * gfortran.dg/typebound_call_15.f03: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160948 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_15.f0325
4 files changed, 40 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a3b35270ba4..11bda1fc4b9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2010-06-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44558
+ * resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
+ Return directly in case of an error.
+
2010-06-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/44549
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 7e6b75aebe1..52920f4e6cc 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5498,7 +5498,8 @@ resolve_typebound_function (gfc_expr* e)
/* Treat the call as if it is a typebound procedure, in order to roll
out the correct name for the specific function. */
- resolve_compcall (e, &name);
+ if (resolve_compcall (e, &name) == FAILURE)
+ return FAILURE;
ts = e->ts;
/* Then convert the expression to a procedure pointer component call. */
@@ -5571,7 +5572,8 @@ resolve_typebound_subroutine (gfc_code *code)
if (code->expr1->value.compcall.tbp->is_generic)
genname = code->expr1->value.compcall.name;
- resolve_typebound_call (code, &name);
+ if (resolve_typebound_call (code, &name) == FAILURE)
+ return FAILURE;
ts = code->expr1->ts;
/* Then convert the expression to a procedure pointer component call. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 65fbf68bfa9..7676e43a9f5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44558
+ * gfortran.dg/typebound_call_15.f03: New.
+
2010-06-17 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/44486
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_15.f03 b/gcc/testsuite/gfortran.dg/typebound_call_15.f03
new file mode 100644
index 00000000000..ac6a668cc46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_15.f03
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR 44558: [OOP] ICE on invalid code: called TBP subroutine as TBP function
+!
+! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
+
+module ice5
+ type::a_type
+ contains
+ procedure::a_subroutine_1
+ procedure::a_subroutine_2
+ end type a_type
+contains
+ real function a_subroutine_1(this)
+ class(a_type)::this
+ real::res
+ res=this%a_subroutine_2() ! { dg-error "should be a FUNCTION" }
+ end function
+ subroutine a_subroutine_2(this)
+ class(a_type)::this
+ call this%a_subroutine_1() ! { dg-error "should be a SUBROUTINE" }
+ end subroutine
+end module ice5
+
+! { dg-final { cleanup-modules "ice5" } }
OpenPOWER on IntegriCloud