jdenny marked 2 inline comments as done.
jdenny added inline comments.

================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7934-7940
+    // If any element has the present modifier, then make sure the runtime
+    // doesn't attempt to allocate the struct.
+    if (CurTypes.end() !=
+        llvm::find_if(CurTypes, [](OpenMPOffloadMappingFlags Type) {
+          return Type & OMP_MAP_PRESENT;
+        }))
+      Types.back() |= OMP_MAP_PRESENT;
----------------
ABataev wrote:
> Why do we need this extra stuff here?
For example:

```
#pragma omp target map(present, tofrom: s.x[0:3])
```

This generates 2 map entries:

  - `s`: 0x1020
  - `s.x`: 0x1000000001003

Without the above change, the 0x1000 is missing from the first entry.  As a 
result, `s` is allocated, and then the presence check for `s.x` incorrectly 
passes at run time.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83061/new/

https://reviews.llvm.org/D83061



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to