re PR fortran/44558 ([OOP] ICE on invalid code: called TBP subroutine as TBP function)

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.

From-SVN: r160948
This commit is contained in:
Janus Weil 2010-06-18 00:15:30 +02:00
parent 60de8907d1
commit 8399a0cc2d
4 changed files with 40 additions and 2 deletions

View File

@ -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

View File

@ -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. */

View File

@ -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

View File

@ -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" } }