aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-03-16 02:56:34 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-03-16 02:56:34 +0000
commit64300da748c4b945cd384d20c4ac85a8db4caaba (patch)
treef2fea6fe750cff8779f86b0d2a96fc5ecfe5215e /gcc
parent93d1ab50c5a8843e7d6779d4f6956241f8444e50 (diff)
downloadgcc-64300da748c4b945cd384d20c4ac85a8db4caaba.zip
gcc-64300da748c4b945cd384d20c4ac85a8db4caaba.tar.gz
gcc-64300da748c4b945cd384d20c4ac85a8db4caaba.tar.bz2
re PR fortran/78741 (ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1534)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr78741.f9016
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 6e1af90..818c50f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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.
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index f5e6b31..64199a96 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9db78cd..a07069f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..6eb8578
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr78741.f90
@@ -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