From f0e618faeb619ec02dabbef203a5575fca44a7f7 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Thu, 4 Feb 2021 12:32:59 +0100 Subject: Fortran: OpenMP/OpenACC diagnose substring rejections better gcc/fortran/ChangeLog: * openmp.c (resolve_omp_clauses): Explicitly diagnose substrings as not permitted. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/substring.f90: New test. * gfortran.dg/gomp/substring.f90: New test. --- gcc/fortran/openmp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 9a3a8f6..aab17f0 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -5212,7 +5212,13 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, || (n->expr && (!resolved || n->expr->expr_type != EXPR_VARIABLE))) { - if (!resolved + if (array_ref + && (array_ref->type == REF_SUBSTRING + || (array_ref->next + && array_ref->next->type == REF_SUBSTRING))) + gfc_error ("Unexpected substring reference in %s clause " + "at %L", name, &n->where); + else if (!resolved || n->expr->expr_type != EXPR_VARIABLE || array_ref->next || array_ref->type != REF_ARRAY) -- cgit v1.1