[OpenMP][Tests][NFC] Work around ICC bug
authorJoachim Protze <protze@itc.rwth-aachen.de>
Mon, 18 Oct 2021 11:33:22 +0000 (13:33 +0200)
committerJoachim Protze <protze@itc.rwth-aachen.de>
Mon, 18 Oct 2021 11:54:15 +0000 (13:54 +0200)
Older intel compilers miss the privatization of nested loop variables for
doacross loops. Declaring the variable in the loop makes the test more
robust.

openmp/runtime/test/ompt/synchronization/ordered_dependences.c

index dc9f082..c3c6471 100644 (file)
@@ -6,11 +6,10 @@
 
 int main() {
   int a[10][10];
-  int i, j;
 #pragma omp parallel num_threads(2)
 #pragma omp for ordered(2)
-  for (i = 0; i < 2; i++)
-    for (j = 0; j < 2; j++) {
+  for (int i = 0; i < 2; i++)
+    for (int j = 0; j < 2; j++) {
       a[i][j] = i + j + 1;
       printf("%d, %d\n", i, j);
 #pragma omp ordered depend(sink : i - 1, j) depend(sink : i, j - 1)