Commit 8bae6273 by Janus Weil

re PR fortran/41556 ([OOP] Errors in applying operator/assignment to an abstract type)

2009-11-05  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41556
	PR fortran/41873
	* resolve.c (resolve_function,resolve_call): Prevent abstract interfaces
	from being called, but allow deferred type-bound procedures with
	abstract interface.


2009-11-05  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41556
	PR fortran/41873
	* gfortran.dg/interface_abstract_4.f90: New test.

From-SVN: r153934
parent eb621985
2009-11-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/41556
PR fortran/41873
* resolve.c (resolve_function,resolve_call): Prevent abstract interfaces
from being called, but allow deferred type-bound procedures with
abstract interface.
2009-11-04 Tobias Burnus <burnus@gcc.gnu.org> 2009-11-04 Tobias Burnus <burnus@gcc.gnu.org>
Janus Weil <janus@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org>
......
...@@ -2526,7 +2526,9 @@ resolve_function (gfc_expr *expr) ...@@ -2526,7 +2526,9 @@ resolve_function (gfc_expr *expr)
return FAILURE; return FAILURE;
} }
if (sym && sym->attr.abstract) /* If this ia a deferred TBP with an abstract interface (which may
of course be referenced), expr->value.function.name will be set. */
if (sym && sym->attr.abstract && !expr->value.function.name)
{ {
gfc_error ("ABSTRACT INTERFACE '%s' must not be referenced at %L", gfc_error ("ABSTRACT INTERFACE '%s' must not be referenced at %L",
sym->name, &expr->where); sym->name, &expr->where);
...@@ -3138,6 +3140,15 @@ resolve_call (gfc_code *c) ...@@ -3138,6 +3140,15 @@ resolve_call (gfc_code *c)
} }
} }
/* If this ia a deferred TBP with an abstract interface
(which may of course be referenced), c->expr1 will be set. */
if (csym && csym->attr.abstract && !c->expr1)
{
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 (csym && is_illegal_recursion (csym, gfc_current_ns))
......
2009-11-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/41556
PR fortran/41873
* gfortran.dg/interface_abstract_4.f90: New test.
2009-11-05 Maxim Kuvyrkov <maxim@codesourcery.com> 2009-11-05 Maxim Kuvyrkov <maxim@codesourcery.com>
* gcc.target/m68k/pr41302.c: Fix target triplet. * gcc.target/m68k/pr41302.c: Fix target triplet.
......
! { dg-do compile }
!
! PR 41873: Bogus Error: ABSTRACT INTERFACE must not be referenced...
!
! Contributed by Harald Anlauf <anlauf@gmx.de>
implicit none
type, abstract :: abstype
contains
procedure(f), nopass, deferred :: f_bound
procedure(s), nopass, deferred :: s_bound
end type
abstract interface
real function f ()
end function
end interface
abstract interface
subroutine s
end subroutine
end interface
contains
subroutine cg (c)
class(abstype) :: c
print *, f() ! { dg-error "must not be referenced" }
call s ! { dg-error "must not be referenced" }
print *, c%f_bound ()
call c%s_bound ()
end subroutine
end
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