[clang] [llvm] [Clang][OpenMP] Support expression semantics in target update fields with non-contiguous array sections (PR #176708)

Amit Tiwari via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 16 07:39:38 PST 2026


================
@@ -0,0 +1,133 @@
+// This test checks that "update from" and "update to" clauses in OpenMP are
+// supported when elements are updated in a non-contiguous manner with variable
+// count expression. Tests #pragma omp target update from/to(data[0:len/2:2])
+// where the count (len/2) is a variable expression, not a constant.
+
+// RUN: %libomptarget-compile-run-and-check-generic
+#include <omp.h>
+#include <stdio.h>
+
+int main() {
+  int len = 10;
+  double data[len];
+
+  // ====================================================================
+  // TEST 1: Update FROM device (device -> host)
+  // ====================================================================
+
+#pragma omp target map(tofrom : len, data[0 : len])
----------------
amitamd7 wrote:

The tests were originally inspired from the standard `sollve` benchmark suite hence followed the similar pattern but your point holds valid here. I have updated the tests. 

https://github.com/llvm/llvm-project/pull/176708


More information about the cfe-commits mailing list