From: Steven G. Kargl Date: Sun, 18 Mar 2018 16:33:55 +0000 (+0000) Subject: re PR fortran/65453 (ICE in build_function_decl, at fortran/trans-decl.c:2001) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81ea7c11e1995736f39b0bbd8aa14160d7f08626;p=gcc.git re PR fortran/65453 (ICE in build_function_decl, at fortran/trans-decl.c:2001) 2018-03-18 Steven G. Kargl PR fortran/65453 * decl.c (get_proc_name): Catch clash between a procedure statement and a contained subprogram 2018-03-18 Steven G. Kargl PR fortran/65453 * gfortran.dg/pr65453.f90: New test. From-SVN: r258632 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 77a6a8ca7e1..0bdc3fe9928 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-03-18 Steven G. Kargl + + PR fortran/65453 + * decl.c (get_proc_name): Catch clash between a procedure statement + and a contained subprogram + 2018-03-16 Steven G. Kargl PR fortran/69395 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 104752586b4..9ffaa78e587 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 7d9a3fd4c2c..71c32f232a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-18 Steven G. Kargl + + PR fortran/65453 + * gfortran.dg/pr65453.f90: New test. + 2018-03-18 Richard Sandiford 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 00000000000..8d30116b79d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr65453.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/65453 +! Contributed by Tobias Burnus +procedure() :: foo ! { dg-error "(1)" } + contains + subroutine foo() ! { dg-error "clashes with procedure" } + end +end