aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2020-08-10 06:19:25 +0100
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 15:07:52 -0300
commite6d42dd6cbf14f5859c0fb8b33a8a61d5906dafe (patch)
treeff5d737ab5c5ff74f18433e9a79d3877e6eeb26f /gcc/fortran
parent03b4e861518e65400524aaaefabb7813aba5fdae (diff)
downloadgcc-e6d42dd6cbf14f5859c0fb8b33a8a61d5906dafe.zip
gcc-e6d42dd6cbf14f5859c0fb8b33a8a61d5906dafe.tar.gz
gcc-e6d42dd6cbf14f5859c0fb8b33a8a61d5906dafe.tar.bz2
This patch fixes PR96102. See the explanatory comment in the testcase.
2020-08-10 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/96102 * resolve.c (check_host_association): Replace the gcc_assert with an error for internal procedures. gcc/testsuite/ PR fortran/96102 * gfortran.dg/pr96102.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/resolve.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 2751c0c..6caddcf 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5993,6 +5993,16 @@ check_host_association (gfc_expr *e)
if (ref->type == REF_ARRAY && ref->next == NULL)
break;
+ if ((ref == NULL || ref->type != REF_ARRAY)
+ && sym->attr.proc == PROC_INTERNAL)
+ {
+ gfc_error ("%qs at %L is host associated at %L into "
+ "a contained procedure with an internal "
+ "procedure of the same name", sym->name,
+ &old_sym->declared_at, &e->where);
+ return false;
+ }
+
gcc_assert (ref->type == REF_ARRAY);
/* Grab the start expressions from the array ref and