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

            Bug ID: 97061
           Summary: [OpenMP] ICE in in omp_add_variable, at
                    gimplify.c:6955
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Found when looking at PR95654 - reduced + modified version of
libgomp.fortran/pr66199-5.f90.

The following ICEs with "gfortran -fopenmp test.f90":

    6 |       u(d1) = 5
      | 
internal compiler error: in omp_add_variable, at gimplify.c:6955
0x671359 omp_add_variable
        ../../repos/gcc/gcc/gimplify.c:6955


integer function f3 (a1, b1)
  integer :: a1, b1, d1
  integer u(0:1023)
  !$omp teams distribute parallel do simd default(none) firstprivate (a1, b1)
shared(u) lastprivate(d1) 
  do d1 = a1, b1-1
      u(d1) = 5
  end do
end

That's the assert:
      /* The only combination of data sharing classes we should see is
         FIRSTPRIVATE and LASTPRIVATE.  However, OpenACC permits
         reduction variables to be used in data sharing clauses.  */
      gcc_assert ((ctx->region_type & ORT_ACC) != 0
                  || ((nflags & GOVD_DATA_SHARE_CLASS)
                      == (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE))
                  || (flags & GOVD_DATA_SHARE_CLASS) == 0);

Original dump:
  #pragma omp teams firstprivate(a1) firstprivate(b1) shared(u) default(none)
          #pragma omp distribute lastprivate(d1)
                #pragma omp parallel firstprivate(a1) firstprivate(b1)
lastprivate(d1) shared(u) default(none)
                      #pragma omp for nowait
                            #pragma omp simd linear(d1:1) lastprivate(d1)

Reply via email to