+2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78741
+ * decl.c (get_proc_name): Check for clash of entry name with
+ subroutine name.
+
2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69395
accessible names. */
if (sym->attr.flavor != 0
&& sym->attr.proc != 0
- && (sym->attr.subroutine || sym->attr.function)
+ && (sym->attr.subroutine || sym->attr.function || sym->attr.entry)
&& sym->attr.if_source != IFSRC_UNKNOWN)
gfc_error_now ("Procedure %qs at %C is already defined at %L",
name, &sym->declared_at);
+ if (sym->attr.flavor != 0
+ && sym->attr.entry && sym->attr.if_source != IFSRC_UNKNOWN)
+ gfc_error_now ("Procedure %qs at %C is already defined at %L",
+ name, &sym->declared_at);
+
/* Trap a procedure with a name the same as interface in the
encompassing scope. */
if (sym->attr.generic != 0
--- /dev/null
+! { dg-do compile }
+! PR fortran/78741
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran at t-online.de>
+subroutine s(n, x)
+ integer :: n
+ character(n) :: x
+ character, pointer :: z(:)
+ x = 'a'
+ return
+entry g(n, x) ! { dg-error "is already defined" }
+ x = 'b'
+contains
+ subroutine g ! { dg-error "(1)" }
+ z(1) = x(1:1)
+ end
+end