diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-02-24 20:11:11 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-02-24 20:11:11 +0100 |
commit | 9d2a69106beb346be1c511a9c1a61a256b697868 (patch) | |
tree | 9a4a8cfa512a426e8d92eecada77af812c842663 /libcpp | |
parent | 35da095d7e0614235cb0e241685c5e1a240dc882 (diff) | |
download | gcc-9d2a69106beb346be1c511a9c1a61a256b697868.zip gcc-9d2a69106beb346be1c511a9c1a61a256b697868.tar.gz gcc-9d2a69106beb346be1c511a9c1a61a256b697868.tar.bz2 |
openmp: Diagnose invalid teams nested in target construct [PR99226]
The OpenMP standard says:
"A teams region can only be strictly nested within the implicit parallel region
or a target region. If a teams construct is nested within a target construct,
that target construct must contain no statements, declarations or directives
outside of the teams construct."
We weren't diagnosing that restriction, because we need to allow e.g.
#pragma omp target
{{{{{{
#pragma omp teams
;
}}}}}}
and as target doesn't need to have teams nested in it, using some special
parser of the target body didn't feel right. And after the parsing,
the question is if e.g. already parsing of the clauses doesn't add some
statements before the teams statement (gimplification certainly will).
As we now have a bugreport where we ICE on the invalid code, this just
diagnoses a subset of the invalid programs, in particular those where
nest to the teams strictly nested in targets the target region contains
some other OpenMP construct.
2021-02-24 Jakub Jelinek <jakub@redhat.com>
PR fortran/99226
* omp-low.c (struct omp_context): Add teams_nested_p and
nonteams_nested_p members.
(scan_omp_target): Diagnose teams nested inside of target with other
directives strictly nested inside of the same target.
(check_omp_nesting_restrictions): Set ctx->teams_nested_p or
ctx->nonteams_nested_p as needed.
* c-c++-common/gomp/pr99226.c: New test.
* gfortran.dg/gomp/pr99226.f90: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions