This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46952] [OOP] Spurious "recursive call" error with type bound procedure
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 Jan 2013 14:09:54 +0000
- Subject: [Bug fortran/46952] [OOP] Spurious "recursive call" error with type bound procedure
- Auto-submitted: auto-generated
- References: <bug-46952-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46952
--- Comment #5 from janus at gcc dot gnu.org 2013-01-10 14:09:54 UTC ---
The following patch is equivalent in functionality to the one in comment 4, but
includes some minor cleanup (and regtests cleanly):
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 194927)
+++ gcc/fortran/resolve.c (working copy)
@@ -3792,28 +3792,30 @@ 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)
+ /* If this ia a deferred TBP, c->expr1 will be set. */
+ if (!c->expr1 && csym)
{
- gfc_error ("ABSTRACT INTERFACE '%s' must not be referenced at %L",
- csym->name, &c->loc);
- return FAILURE;
- }
+ if (csym->attr.abstract)
+ {
+ 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
- * call themselves. */
- if (csym && is_illegal_recursion (csym, gfc_current_ns))
- {
- if (csym->attr.entry && csym->ns->entries)
- gfc_error ("ENTRY '%s' at %L cannot be called recursively, as"
- " subroutine '%s' is not RECURSIVE",
- csym->name, &c->loc, csym->ns->entries->sym->name);
- else
- gfc_error ("SUBROUTINE '%s' at %L cannot be called recursively, as it"
- " is not RECURSIVE", csym->name, &c->loc);
+ /* Subroutines without the RECURSIVE attribution are not allowed to
+ call themselves. */
+ if (is_illegal_recursion (csym, gfc_current_ns))
+ {
+ if (csym->attr.entry && csym->ns->entries)
+ gfc_error ("ENTRY '%s' at %L cannot be called recursively, "
+ "as subroutine '%s' is not RECURSIVE",
+ csym->name, &c->loc, csym->ns->entries->sym->name);
+ else
+ gfc_error ("SUBROUTINE '%s' at %L cannot be called recursively, "
+ "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