[llvm-bugs] [Bug 38825] New: Error when mapping a structure and a contained array section

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 4 07:49:12 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38825

            Bug ID: 38825
           Summary: Error when mapping a structure and a contained array
                    section
           Product: OpenMP
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hahnjo at hahnjo.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 20838
  --> https://bugs.llvm.org/attachment.cgi?id=20838&action=edit
Example code

I may be wrong here with my interpretation of the standard. If so, feel free to
close as INVALID.

$ cat structure-pointer.c
#include <stdlib.h>

typedef struct {
  int *ptr;
  int val;
} StructWithPtr;

int main(int argc, char *argv[]) {
  StructWithPtr s;
  s.ptr = malloc(sizeof(int));
  s.ptr[0] = 1;
  s.val = 2;

#pragma omp target map(s, s.ptr[0:1])
  {
    s.val++;
    s.ptr[0]++;
  }

  free(s.ptr);

  return 0;
}

$ clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda structure-pointer.c
structure-pointer.c:14:27: error: variable already marked as mapped in current
construct
#pragma omp target map(s, s.ptr[0:1])
                          ^~~~~~~~~~
structure-pointer.c:14:24: note: used here
#pragma omp target map(s, s.ptr[0:1])

1 error generated.

I can't find a restriction in standards newer than OpenMP 4.5 but I remember
some discussion about patterns like this (StructWithPtr my have many more
members that would clutter the map clause if listed explicitly).
In the light of p309:1-17 I think this should be allowed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180904/61d8f85e/attachment.html>


More information about the llvm-bugs mailing list