re PR fortran/78741 (ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1534)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 16 Mar 2018 02:56:34 +0000 (02:56 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 16 Mar 2018 02:56:34 +0000 (02:56 +0000)
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/78741
* gfortran.dg/pr78741.f90: New test.

From-SVN: r258581

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr78741.f90 [new file with mode: 0644]

index 6e1af90..818c50f 100644 (file)
@@ -1,5 +1,11 @@
 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
        * decl.c (merge_array_spec): Limit the merging to maximum allowed
        dimensions, and issue error message if limit is exceeded.
index f5e6b31..64199a9 100644 (file)
@@ -1209,11 +1209,16 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
         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
index 9db78cd..a07069f 100644 (file)
@@ -1,5 +1,10 @@
 2018-03-15  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/78741
+       * gfortran.dg/pr78741.f90: New test.
+
+2018-03-15  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/69395
        * gfortran.dg/pr69395.f90: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/pr78741.f90 b/gcc/testsuite/gfortran.dg/pr78741.f90
new file mode 100644 (file)
index 0000000..6eb8578
--- /dev/null
@@ -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