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

            Bug ID: 102972
           Summary: [OpenMP] Strictly-nested diagnostic missing
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Came up at https://github.com/SOLLVE/sollve_vv/issues/409

"17.1 Nesting of Regions" has the following (mirrored in the restriction
section for the teams construct):

"• distribute regions, including any distribute regions arising from composite
constructs,
parallel regions, including any parallel regions arising from combined
constructs, loop
regions, omp_get_num_teams() regions, and omp_get_team_num() regions are the
only OpenMP regions that may be strictly nested inside the teams region."

And it seems as if this is violated for the following:

#include <omp.h>

void foo(int *a, int N) {
  int is_initial = 0;
  #pragma omp target
    #pragma omp teams
    {
      is_initial = omp_is_initial_device();

      #pragma omp distribute parallel for
        for (int i = 0; i < N; i++) {
           a[i] = i;
        }
    }
}

Reply via email to