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

            Bug ID: 128969
           Summary: [OpenMP] Deep mapping - off-by-one array-mapping error
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Created attachment 66268
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66268&action=edit
Testcase - compile with "gfortran -fopenmp" and run with offloading.

This is the testcase
https://github.com/sbryngelson/offtarget/blob/master/data/findings/stress/gcc-declare-target-allocatable-component-ice.f90

This test reveals two issues:

* And ICE because of an ordering issue in gimplify.cc regarding global
  variables with allocatable components

* An off-by-one error with mapping. Running the code without offloading
  produces the expected:

  out= 4,7,10, ..., 190,193

  however, with actual offloading, it is:

  out= 7,10,13, ..., 190,193,1

Namely, everything is shifted by one array element to the left!

Reply via email to