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

            Bug ID: 63246
           Summary: OpenMP target: gimplifier produces unsuitable implicit
                    map clauses if inside a data region
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org

Consider:

    int
    main(int argc, char **argv)
    {
    #define N 4
        short a[N];

    #pragma omp target data map(a[1:N-1])
        {
    #pragma omp target
          {
            a[1] = 51;
          }
        }

        return 0;
    }

..., which results in the following gimple:

    [...]
          #pragma omp target data map(tofrom:a[1] [len: 6]) map(alloc:a
[pointer assign, bias: 2])
            {
              try
                {
                  {
                    #pragma omp target map(tofrom:a [len: 8])
                      {
                        {
                          a[1] = 51;
    [...]

The outer data region sets up an expicit mapping for a subset of the array, and
the inner target construct then again gets an implicit map clause added for
*the whole* region.  A suitably equipped libgomp (for example, gomp-4_0-branch
with the non-shared memory host plugin) doesn't like this:

    libgomp: Trying to map into device [0x7fff6f513410..0x7fff6f513418) object
when[0x7fff6f513412..0x7fff6f513418) is already mapped

Reply via email to