[clang] fb8c0e6 - [Clang][OpenMP][NFC] Diagnostics/parsing tests for non-contiguous updates. (#181780)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 25 01:03:18 PST 2026
Author: Amit Tiwari
Date: 2026-02-25T14:33:13+05:30
New Revision: fb8c0e65bc14cae5fb90ce2225a1d20ab4dcbe0f
URL: https://github.com/llvm/llvm-project/commit/fb8c0e65bc14cae5fb90ce2225a1d20ab4dcbe0f
DIFF: https://github.com/llvm/llvm-project/commit/fb8c0e65bc14cae5fb90ce2225a1d20ab4dcbe0f.diff
LOG: [Clang][OpenMP][NFC] Diagnostics/parsing tests for non-contiguous updates. (#181780)
NFC PR for validating parsing checks for variable count/stride,
pointer-based array sections, struct member array sections,
multiple/partial array updates -- for non-contiguous updates
Added:
clang/test/OpenMP/target_update_strided_ptr_variable_count_and_stride_messages.c
clang/test/OpenMP/target_update_strided_ptr_variable_count_messages.c
clang/test/OpenMP/target_update_strided_ptr_variable_stride_messages.c
clang/test/OpenMP/target_update_strided_struct_ptr_messages_from.c
clang/test/OpenMP/target_update_strided_struct_ptr_messages_to.c
clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_from.c
clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_to.c
clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_from.c
clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_to.c
clang/test/OpenMP/target_update_strided_struct_variable_count_and_stride_messages.c
clang/test/OpenMP/target_update_variable_count_and_stride_messages.c
Modified:
Removed:
################################################################################
diff --git a/clang/test/OpenMP/target_update_strided_ptr_variable_count_and_stride_messages.c b/clang/test/OpenMP/target_update_strided_ptr_variable_count_and_stride_messages.c
new file mode 100644
index 0000000000000..61d40462ba8e9
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_ptr_variable_count_and_stride_messages.c
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+int main(int argc, char **argv) {
+ int len = 16;
+ int count = 8;
+ int stride = 2;
+ int stride_large = 5;
+ double *data;
+
+ // Valid strided array sections with both variable count and variable stride (FROM)
+ #pragma omp target update from(data[0:count:stride]) // OK - both variable
+
+ #pragma omp target update from(data[0:len/2:stride]) // OK - count expression, variable stride
+
+ #pragma omp target update from(data[0:count:stride_large]) // OK - variable count,
diff erent stride
+
+ #pragma omp target update from(data[1:len-2:stride]) // OK - with offset, count expression
+
+ #pragma omp target update from(data[0:count/2:stride*2]) // OK - both expressions
+
+ #pragma omp target update from(data[0:(len+1)/2:stride+1]) // OK - complex expressions
+
+ #pragma omp target update from(data[2:count-2:len/4]) // OK - all expressions
+
+ #pragma omp target update from(data[0:len/stride:stride]) // OK - count depends on stride
+
+ // Valid strided array sections with variable count and stride (TO)
+ #pragma omp target update to(data[0:count:stride]) // OK
+
+ #pragma omp target update to(data[0:len/2:stride]) // OK
+
+ #pragma omp target update to(data[0:count:stride*2]) // OK
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_ptr_variable_count_messages.c b/clang/test/OpenMP/target_update_strided_ptr_variable_count_messages.c
new file mode 100644
index 0000000000000..e00dfb77a8245
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_ptr_variable_count_messages.c
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+int main(int argc, char **argv) {
+ int len = 16;
+ int count = 8;
+ int divisor = 2;
+ double *data;
+
+ // Valid strided array sections with variable count expressions (FROM)
+ #pragma omp target update from(data[0:count:2]) // OK - variable count
+
+ #pragma omp target update from(data[0:len/2:2]) // OK - count expression
+
+ #pragma omp target update from(data[0:len-4:3]) // OK - count with subtraction
+
+ #pragma omp target update from(data[1:(len+1)/2:2]) // OK - complex count expression
+
+ #pragma omp target update from(data[0:count*2:3]) // OK - count multiplication
+
+ #pragma omp target update from(data[2:len%divisor:2]) // OK - count with modulo
+
+ // Variable count with stride = 1 (contiguous)
+ #pragma omp target update from(data[0:count]) // OK - variable count, implicit stride
+
+ #pragma omp target update from(data[0:len/divisor]) // OK - expression count, implicit stride
+
+ // Invalid stride expressions with variable count
+ #pragma omp target update from(data[0:count:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ #pragma omp target update from(data[0:len/2:-1]) // expected-error {{section stride is evaluated to a non-positive value -1}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ #pragma omp target update from(data[1:count:-2]) // expected-error {{section stride is evaluated to a non-positive value -2}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ // Valid strided array sections with variable count expressions (TO)
+ #pragma omp target update to(data[0:count:2]) // OK
+
+ #pragma omp target update to(data[0:len/2:2]) // OK
+
+ #pragma omp target update to(data[0:len-4:3]) // OK
+
+ // Invalid stride with TO
+ #pragma omp target update to(data[0:count:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_ptr_variable_stride_messages.c b/clang/test/OpenMP/target_update_strided_ptr_variable_stride_messages.c
new file mode 100644
index 0000000000000..41dd89c362915
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_ptr_variable_stride_messages.c
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+int main(int argc, char **argv) {
+ int len = 16;
+ int stride = 2;
+ int stride_large = 5;
+ double *data;
+
+ // Valid strided array sections with variable stride (FROM)
+ #pragma omp target update from(data[0:8:stride]) // OK - variable stride
+
+ #pragma omp target update from(data[0:4:stride_large]) // OK -
diff erent variable stride
+
+ #pragma omp target update from(data[1:6:stride]) // OK - with offset
+
+ #pragma omp target update from(data[0:5:stride+1]) // OK - stride expression
+
+ #pragma omp target update from(data[0:4:stride*2]) // OK - stride multiplication
+
+ #pragma omp target update from(data[2:3:len/4]) // OK - stride from expression
+
+ // Invalid variable stride expressions
+ int zero_stride = 0;
+ int neg_stride = -1;
+
+ // Note: These are runtime checks, so no compile-time error
+ #pragma omp target update from(data[0:8:zero_stride]) // OK at compile-time (runtime will fail)
+
+ #pragma omp target update from(data[0:4:neg_stride]) // OK at compile-time (runtime will fail)
+
+ // Valid strided array sections with variable stride (TO)
+ #pragma omp target update to(data[0:8:stride]) // OK
+
+ #pragma omp target update to(data[0:5:stride+1]) // OK
+
+ #pragma omp target update to(data[0:4:stride*2]) // OK
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_ptr_messages_from.c b/clang/test/OpenMP/target_update_strided_struct_ptr_messages_from.c
new file mode 100644
index 0000000000000..5e301f384498b
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_ptr_messages_from.c
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+#define N 16
+typedef struct {
+ double *data;
+ int len;
+} T;
+
+int main(int argc, char **argv) {
+ T s;
+ s.len = N;
+ s.data = (double *)__builtin_alloca(N * sizeof(double));
+
+ // Valid strided array sections with pointer member
+ #pragma omp target update from(s.data[0:4:2]) // OK
+
+ #pragma omp target update from(s.data[1:3:2]) // OK
+
+ // Missing stride (default = 1)
+ #pragma omp target update from(s.data[0:4]) // OK
+
+ // Invalid stride expressions
+ #pragma omp target update from(s.data[0:4:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ #pragma omp target update from(s.data[0:4:-1]) // expected-error {{section stride is evaluated to a non-positive value -1}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ // Missing colon
+ #pragma omp target update from(s.data[0:4 2]) // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ // Too many colons
+ #pragma omp target update from(s.data[0:4:2:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_ptr_messages_to.c b/clang/test/OpenMP/target_update_strided_struct_ptr_messages_to.c
new file mode 100644
index 0000000000000..648ba6b7e675d
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_ptr_messages_to.c
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+#define N 16
+typedef struct {
+ double *data;
+ int len;
+} T;
+
+int main(int argc, char **argv) {
+ T s;
+ s.len = N;
+ s.data = (double *)__builtin_alloca(N * sizeof(double));
+
+ // Valid strided array sections with pointer member
+ #pragma omp target update to(s.data[0:4:2]) // OK
+
+ #pragma omp target update to(s.data[1:3:2]) // OK
+
+ // Missing stride (default = 1)
+ #pragma omp target update to(s.data[0:4]) // OK
+
+ // Invalid stride expressions
+ #pragma omp target update to(s.data[0:4:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ #pragma omp target update to(s.data[0:4:-1]) // expected-error {{section stride is evaluated to a non-positive value -1}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ // Missing colon
+ #pragma omp target update to(s.data[0:4 2]) // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ // Too many colons
+ #pragma omp target update to(s.data[0:4:2:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_from.c b/clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_from.c
new file mode 100644
index 0000000000000..6aacc1f001b3a
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_from.c
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+#define N 20
+typedef struct {
+ double *data;
+ int len;
+} T;
+
+int main(int argc, char **argv) {
+ T s1, s2;
+ s1.len = N;
+ s1.data = (double *)__builtin_alloca(N * sizeof(double));
+ s2.len = N;
+ s2.data = (double *)__builtin_alloca(N * sizeof(double));
+
+ // Multiple valid strided updates
+ #pragma omp target update from(s1.data[0:10:2], s2.data[0:7:3]) // OK
+
+ // Mixed: one with stride, one without
+ #pragma omp target update from(s1.data[0:N], s2.data[0:5:2]) // OK
+
+ int stride1 = 2;
+ int stride2 = 3;
+
+ // Multiple with expression strides
+ #pragma omp target update from(s1.data[1:5:stride1], s2.data[0:4:stride2]) // OK
+
+ // One valid, one invalid
+ #pragma omp target update from(s1.data[0:5:2], s2.data[0:4:0]) // expected-error {{section stride is evaluated to a non-positive value 0}}
+
+ #pragma omp target update from(s1.data[0:5:-1], s2.data[0:4:2]) // expected-error {{section stride is evaluated to a non-positive value -1}}
+
+ #pragma omp target update from(s1.data[0:5:0], s2.data[0:4:1]) // expected-error {{section stride is evaluated to a non-positive value 0}}
+
+ // Syntax errors
+ #pragma omp target update from(s1.data[0:5:2], s2.data[0:4 3]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
+
+ #pragma omp target update from(s1.data[0:5:2:3], s2.data[0:4:2]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_to.c b/clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_to.c
new file mode 100644
index 0000000000000..ea6f029c70320
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_ptr_multiple_messages_to.c
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+#define N 20
+typedef struct {
+ double *data;
+ int len;
+} T;
+
+int main(int argc, char **argv) {
+ T s1, s2;
+ s1.len = N;
+ s1.data = (double *)__builtin_alloca(N * sizeof(double));
+ s2.len = N;
+ s2.data = (double *)__builtin_alloca(N * sizeof(double));
+
+ // Multiple valid strided updates (to clause)
+ #pragma omp target update to(s1.data[0:10:2], s2.data[0:7:3]) // OK
+
+ // Mixed: one with stride, one without
+ #pragma omp target update to(s1.data[0:N], s2.data[0:5:2]) // OK
+
+ int stride1 = 2;
+ int stride2 = 3;
+
+ // Multiple with expression strides
+ #pragma omp target update to(s1.data[1:5:stride1], s2.data[0:4:stride2]) // OK
+
+ // One valid, one invalid
+ #pragma omp target update to(s1.data[0:5:2], s2.data[0:4:0]) // expected-error {{section stride is evaluated to a non-positive value 0}}
+
+ #pragma omp target update to(s1.data[0:5:-1], s2.data[0:4:2]) // expected-error {{section stride is evaluated to a non-positive value -1}}
+
+ #pragma omp target update to(s1.data[0:5:0], s2.data[0:4:1]) // expected-error {{section stride is evaluated to a non-positive value 0}}
+
+ // Syntax errors
+ #pragma omp target update to(s1.data[0:5:2], s2.data[0:4 3]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
+
+ #pragma omp target update to(s1.data[0:5:2:3], s2.data[0:4:2]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_from.c b/clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_from.c
new file mode 100644
index 0000000000000..c2a1eeb256117
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_from.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+#define N 24
+typedef struct {
+ double *data;
+ int len;
+} T;
+
+int main(int argc, char **argv) {
+ T s;
+ s.len = N;
+ s.data = (double *)__builtin_alloca(N * sizeof(double));
+
+ // Valid partial strided updates with pointer member
+ #pragma omp target update from(s.data[0:2:10]) // OK - partial coverage (stride > length)
+
+ // Valid: complex expressions
+ int offset = 1;
+
+ // Runtime-dependent stride expressions
+ #pragma omp target update from(s.data[0:4:offset+1]) // OK
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_to.c b/clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_to.c
new file mode 100644
index 0000000000000..699082b2faf53
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_ptr_partial_messages_to.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+#define N 24
+typedef struct {
+ double *data;
+ int len;
+} T;
+
+int main(int argc, char **argv) {
+ T s;
+ s.len = N;
+ s.data = (double *)__builtin_alloca(N * sizeof(double));
+
+ // Valid partial strided updates with pointer member (to clause)
+ #pragma omp target update to(s.data[0:2:10]) // OK - partial coverage (stride > length)
+
+ // Valid: complex expressions
+ int offset = 1;
+
+ // Runtime-dependent stride expressions
+ #pragma omp target update to(s.data[0:4:offset+1]) // OK
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_strided_struct_variable_count_and_stride_messages.c b/clang/test/OpenMP/target_update_strided_struct_variable_count_and_stride_messages.c
new file mode 100644
index 0000000000000..8658ec06ce7c1
--- /dev/null
+++ b/clang/test/OpenMP/target_update_strided_struct_variable_count_and_stride_messages.c
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+
+#define N 20
+typedef struct {
+ double data[N];
+ int len;
+ int stride;
+} T;
+
+int main(int argc, char **argv) {
+ T s;
+ s.len = 16;
+ s.stride = 2;
+ int count = 8;
+ int ext_stride = 3;
+
+ // Valid strided struct member array sections with variable count/stride (FROM)
+ #pragma omp target update from(s.data[0:s.len/2:2]) // OK - member count expression
+
+ #pragma omp target update from(s.data[0:count:s.stride]) // OK - external count, member stride
+
+ #pragma omp target update from(s.data[0:s.len:ext_stride]) // OK - member count, external stride
+
+ #pragma omp target update from(s.data[0:count:ext_stride]) // OK - both external
+
+ #pragma omp target update from(s.data[0:s.len/2:s.stride]) // OK - both from struct
+
+ #pragma omp target update from(s.data[1:(s.len-2)/2:s.stride]) // OK - complex count expression
+
+ #pragma omp target update from(s.data[0:count*2:s.stride+1]) // OK - expressions for both
+
+ #pragma omp target update from(s.data[0:s.len/s.stride:s.stride]) // OK - count depends on stride
+
+ // Invalid compile-time constant strides with variable count
+ #pragma omp target update from(s.data[0:s.len:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ #pragma omp target update from(s.data[0:count:-1]) // expected-error {{section stride is evaluated to a non-positive value -1}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ #pragma omp target update from(s.data[1:s.len/2:-2]) // expected-error {{section stride is evaluated to a non-positive value -2}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ // Valid strided struct member array sections with variable count and stride (TO)
+ #pragma omp target update to(s.data[0:s.len/2:2]) // OK
+
+ #pragma omp target update to(s.data[0:count:s.stride]) // OK
+
+ #pragma omp target update to(s.data[0:s.len:ext_stride]) // OK
+
+ #pragma omp target update to(s.data[0:count*2:s.stride+1]) // OK
+
+ // Invalid stride with TO
+ #pragma omp target update to(s.data[0:s.len:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+
+ return 0;
+}
diff --git a/clang/test/OpenMP/target_update_variable_count_and_stride_messages.c b/clang/test/OpenMP/target_update_variable_count_and_stride_messages.c
new file mode 100644
index 0000000000000..5d8c51584bcf1
--- /dev/null
+++ b/clang/test/OpenMP/target_update_variable_count_and_stride_messages.c
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
+// expected-no-diagnostics
+
+int main(int argc, char **argv) {
+ int len = 16;
+ int count = 8;
+ int stride = 2;
+ int divisor = 2;
+ double data[100];
+
+ // Valid strided array sections with variable count expressions (FROM)
+ #pragma omp target update from(data[0:count:2]) // OK - variable count
+
+ #pragma omp target update from(data[0:len/2:2]) // OK - count expression
+
+ #pragma omp target update from(data[0:len-4:3]) // OK - count with subtraction
+
+ #pragma omp target update from(data[1:(len+1)/2:2]) // OK - complex count expression
+
+ #pragma omp target update from(data[0:count*2:3]) // OK - count multiplication
+
+ #pragma omp target update from(data[2:len%divisor:2]) // OK - count with modulo
+
+ // Variable stride with constant/variable count
+ #pragma omp target update from(data[0:10:stride]) // OK - constant count, variable stride
+
+ #pragma omp target update from(data[0:count:stride]) // OK - both variable
+
+ #pragma omp target update from(data[0:len/2:stride]) // OK - count expression, variable stride
+
+ #pragma omp target update from(data[0:count:stride*2]) // OK - variable count, stride expression
+
+ #pragma omp target update from(data[0:len/divisor:stride+1]) // OK - both expressions
+
+ // Variable count with stride = 1 (contiguous)
+ #pragma omp target update from(data[0:count]) // OK - variable count, implicit stride
+
+ #pragma omp target update from(data[0:len/divisor]) // OK - expression count, implicit stride
+
+ #pragma omp target update from(data[0:len/stride:stride]) // OK - count depends on stride
+
+ // Valid strided array sections with variable count expressions (TO)
+ #pragma omp target update to(data[0:count:2]) // OK
+
+ #pragma omp target update to(data[0:len/2:stride]) // OK
+
+ #pragma omp target update to(data[0:count:stride]) // OK
+
+ #pragma omp target update to(data[0:len/divisor:stride+1]) // OK
+
+ return 0;
+}
More information about the cfe-commits
mailing list