]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/65453 (ICE in build_function_decl, at fortran/trans-decl.c:2001)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 19 Mar 2018 19:14:06 +0000 (19:14 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 19 Mar 2018 19:14:06 +0000 (19:14 +0000)
2018-03-19  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-19  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/65453
* gfortran.dg/pr65453.f90: New test.

From-SVN: r258657

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

index 433d66b4ee16cac4b66dca9c2fdffa8dca51e365..b602174069a8f527d90dddb85ea46d56a04da69f 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-19  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-12  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/83939
index 29656284fbffea3b38d61fb32e859fe5954e2ba1..4000a0c76b6d7e74e56fe7ef9de81e429574da6b 100644 (file)
@@ -1171,6 +1171,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
index d29d0a61c4e4f1de81b654227dc1ee0f9a017b2b..2f58b0ffaf0c928123cd4c18cfbe09bf5ba7798d 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-19  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/65453
+       * gfortran.dg/pr65453.f90: New test.
+
 2018-03-12  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/83939
diff --git a/gcc/testsuite/gfortran.dg/pr65453.f90 b/gcc/testsuite/gfortran.dg/pr65453.f90
new file mode 100644 (file)
index 0000000..8d30116
--- /dev/null
@@ -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