aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/openmp.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-01-12 11:43:37 +0100
committerTobias Burnus <tobias@codesourcery.com>2023-01-12 11:43:37 +0100
commit2ce55247a8bf32985a96ed63a7a92d36746723dc (patch)
tree96cc787d634265231f3163720993a9aedfe88222 /gcc/fortran/openmp.cc
parentf54e3b3ba01ced7ecda3caed51b42f707d489c77 (diff)
downloadgcc-2ce55247a8bf32985a96ed63a7a92d36746723dc.zip
gcc-2ce55247a8bf32985a96ed63a7a92d36746723dc.tar.gz
gcc-2ce55247a8bf32985a96ed63a7a92d36746723dc.tar.bz2
Fortran/OpenMP: Reject non-scalar 'holds' expr in 'omp assume(s)' [PR107706]
gcc/fortran/ChangeLog: PR fortran/107706 * openmp.cc (gfc_resolve_omp_assumptions): Reject nonscalars. gcc/testsuite/ChangeLog: PR fortran/107706 * gfortran.dg/gomp/assume-2.f90: Update dg-error. * gfortran.dg/gomp/assumes-2.f90: Likewise. * gfortran.dg/gomp/assume-5.f90: New test.
Diffstat (limited to 'gcc/fortran/openmp.cc')
-rw-r--r--gcc/fortran/openmp.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index b71ee46..916daeb 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -6911,9 +6911,11 @@ void
gfc_resolve_omp_assumptions (gfc_omp_assumptions *assume)
{
for (gfc_expr_list *el = assume->holds; el; el = el->next)
- if (!gfc_resolve_expr (el->expr) || el->expr->ts.type != BT_LOGICAL)
- gfc_error ("HOLDS expression at %L must be a logical expression",
- &el->expr->where);
+ if (!gfc_resolve_expr (el->expr)
+ || el->expr->ts.type != BT_LOGICAL
+ || el->expr->rank != 0)
+ gfc_error ("HOLDS expression at %L must be a scalar logical expression",
+ &el->expr->where);
}