On Thu, Mar 15, 2018 at 01:18:02PM -0700, Steve Kargl wrote: > The patch is fairly slef-explanatory.
Well, it would be self-explanatory if I sent the right patch. (Two pathces touch same file). -- Steve
Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 258571) +++ gcc/fortran/decl.c (working copy) @@ -1189,8 +1209,13 @@ get_proc_name (const char *name, gfc_symbol **result, 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); Index: gcc/testsuite/gfortran.dg/pr78741.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr78741.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr78741.f90 (working copy) @@ -0,0 +1,16 @@ +! { 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