Commit fdb1fa9e by Janus Weil

re PR fortran/46952 ([OOP] Spurious "recursive call" error with type bound procedure)

2013-02-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/46952
	* resolve.c (resolve_call): Do not check deferred procedures for
	recursiveness.


2013-02-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/46952
	* gfortran.dg/typebound_deferred_1.f90: New.

From-SVN: r195975
parent fdec36ab
2013-02-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/46952
* resolve.c (resolve_call): Do not check deferred procedures for
recursiveness.
2013-02-09 Paul Thomas <pault@gcc.gnu.org> 2013-02-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55362 PR fortran/55362
......
...@@ -3785,28 +3785,30 @@ resolve_call (gfc_code *c) ...@@ -3785,28 +3785,30 @@ resolve_call (gfc_code *c)
} }
} }
/* If this ia a deferred TBP with an abstract interface /* If this ia a deferred TBP, c->expr1 will be set. */
(which may of course be referenced), c->expr1 will be set. */ if (!c->expr1 && csym)
if (csym && csym->attr.abstract && !c->expr1)
{ {
gfc_error ("ABSTRACT INTERFACE '%s' must not be referenced at %L", if (csym->attr.abstract)
csym->name, &c->loc); {
return FAILURE; gfc_error ("ABSTRACT INTERFACE '%s' must not be referenced at %L",
} csym->name, &c->loc);
return FAILURE;
}
/* Subroutines without the RECURSIVE attribution are not allowed to /* Subroutines without the RECURSIVE attribution are not allowed to
* call themselves. */ call themselves. */
if (csym && is_illegal_recursion (csym, gfc_current_ns)) if (is_illegal_recursion (csym, gfc_current_ns))
{ {
if (csym->attr.entry && csym->ns->entries) if (csym->attr.entry && csym->ns->entries)
gfc_error ("ENTRY '%s' at %L cannot be called recursively, as" gfc_error ("ENTRY '%s' at %L cannot be called recursively, "
" subroutine '%s' is not RECURSIVE", "as subroutine '%s' is not RECURSIVE",
csym->name, &c->loc, csym->ns->entries->sym->name); csym->name, &c->loc, csym->ns->entries->sym->name);
else else
gfc_error ("SUBROUTINE '%s' at %L cannot be called recursively, as it" gfc_error ("SUBROUTINE '%s' at %L cannot be called recursively, "
" is not RECURSIVE", csym->name, &c->loc); "as it is not RECURSIVE", csym->name, &c->loc);
t = FAILURE; t = FAILURE;
}
} }
/* Switch off assumed size checking and do this again for certain kinds /* Switch off assumed size checking and do this again for certain kinds
......
2013-02-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/46952
* gfortran.dg/typebound_deferred_1.f90: New.
2013-02-12 Jakub Jelinek <jakub@redhat.com> 2013-02-12 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/56151 PR rtl-optimization/56151
......
! { dg-do compile }
!
! PR 46952: [OOP] Spurious "recursive call" error with type bound procedure
!
! Contributed by Ian Harvey <ian_harvey@bigpond.com>
module m
type, abstract :: t
contains
procedure(inter), pass, deferred :: foo
end type
contains
subroutine inter(this)
class(t) :: this
call this%foo()
end subroutine inter
end module m
! { dg-final { cleanup-modules "m" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment