https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99226

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:9d2a69106beb346be1c511a9c1a61a256b697868

commit r11-7375-g9d2a69106beb346be1c511a9c1a61a256b697868
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Feb 24 20:11:11 2021 +0100

    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  <ja...@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.

Reply via email to