+2008-09-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37583
+ * decl.c (scalarize_intrinsic_call): Both subroutines and
+ functions can give a true for get_proc_mame's last argument so
+ remove the &&gfc_current_ns->proc_name->attr.function.
+ resolve.c (resolve_actual_arglist): Add check for recursion by
+ reference to procedure as actual argument.
+
2008-09-21 Daniel Kraft <d@domob.eu>
PR fortran/35846
created symbols attached to the current namespace. */
if (get_proc_name (name, &entry,
gfc_current_ns->parent != NULL
- && module_procedure
- && gfc_current_ns->proc_name->attr.function))
+ && module_procedure))
return MATCH_ERROR;
proc = gfc_current_block ();
/* Just in case a specific was found for the expression. */
sym = e->symtree->n.sym;
+ if (sym->attr.entry && sym->ns->entries
+ && sym->ns == gfc_current_ns
+ && !sym->ns->entries->sym->attr.recursive)
+ {
+ gfc_error ("Reference to ENTRY '%s' at %L is recursive, but procedure "
+ "'%s' is not declared as RECURSIVE",
+ sym->name, &e->where, sym->ns->entries->sym->name);
+ }
+
/* If the symbol is the function that names the current (or
parent) scope, then we really have a variable reference. */
+2008-09-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37583
+ * gfortran.dg/entry_18.f90: New test.
+
2008-09-21 Daniel Kraft <d@domob.eu>
PR fortran/35846
--- /dev/null
+! { dg-do compile }
+! Test fix for PR37583, in which:
+! (i) the reference to glocal prior to the ENTRY caused an internal
+! error and
+! (ii) the need for a RECURSIVE attribute was ignored.
+!
+! Contributed by Arjen Markus <arjen.markus@wldelft.nl>
+!
+module gsub
+contains
+recursive subroutine suba( g ) ! prefix with "RECURSIVE"
+ interface
+ real function g(x)
+ real x
+ end function
+ end interface
+ real :: x, y
+ call mysub( glocala )
+ return
+entry glocala( x, y )
+ y = x
+end subroutine
+subroutine subb( g )
+ interface
+ real function g(x)
+ real x
+ end function
+ end interface
+ real :: x, y
+ call mysub( glocalb ) ! { dg-error "is recursive" }
+ return
+entry glocalb( x, y )
+ y = x
+end subroutine
+end module
+! { dg-final { cleanup-modules "gsub" } }