aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-03-18 16:33:55 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-03-18 16:33:55 +0000
commit81ea7c11e1995736f39b0bbd8aa14160d7f08626 (patch)
tree881ad02b918ea94bdfcd3ba0aaed24378f9b4ce9 /gcc
parent928b965f29f587bb033555f0db646c94afe8e7ef (diff)
downloadgcc-81ea7c11e1995736f39b0bbd8aa14160d7f08626.zip
gcc-81ea7c11e1995736f39b0bbd8aa14160d7f08626.tar.gz
gcc-81ea7c11e1995736f39b0bbd8aa14160d7f08626.tar.bz2
re PR fortran/65453 (ICE in build_function_decl, at fortran/trans-decl.c:2001)
2018-03-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/65453 * decl.c (get_proc_name): Catch clash between a procedure statement and a contained subprogram 2018-03-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/65453 * gfortran.dg/pr65453.f90: New test. From-SVN: r258632
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr65453.f908
4 files changed, 25 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 77a6a8c..0bdc3fe 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-18 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/65453
+ * decl.c (get_proc_name): Catch clash between a procedure statement
+ and a contained subprogram
+
2018-03-16 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69395
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 1047525..9ffaa78 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1219,6 +1219,12 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
gfc_error_now ("Procedure %qs at %C is already defined at %L",
name, &sym->declared_at);
+ if (sym->attr.external && sym->attr.procedure
+ && gfc_current_state () == COMP_CONTAINS)
+ gfc_error_now ("Contained procedure %qs at %C clashes with "
+ "procedure 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 7d9a3fd..71c32f2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-18 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/65453
+ * gfortran.dg/pr65453.f90: New test.
+
2018-03-18 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/84913
diff --git a/gcc/testsuite/gfortran.dg/pr65453.f90 b/gcc/testsuite/gfortran.dg/pr65453.f90
new file mode 100644
index 0000000..8d30116
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr65453.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/65453
+! Contributed by Tobias Burnus <burnus at gcc.gnu.org>
+procedure() :: foo ! { dg-error "(1)" }
+ contains
+ subroutine foo() ! { dg-error "clashes with procedure" }
+ end
+end