[Openmp-commits] [openmp] 9e5aefc - [OpenMP][Tests] fix data race in an OpenMP runtime test

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 15 09:48:54 PDT 2020


Author: Joachim Protze
Date: 2020-06-15T18:48:35+02:00
New Revision: 9e5aefc5f93a0cdb00c89830e3cfaf5a706340c4

URL: https://github.com/llvm/llvm-project/commit/9e5aefc5f93a0cdb00c89830e3cfaf5a706340c4
DIFF: https://github.com/llvm/llvm-project/commit/9e5aefc5f93a0cdb00c89830e3cfaf5a706340c4.diff

LOG: [OpenMP][Tests] fix data race in an OpenMP runtime test

Reviewed by: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D81804

Added: 
    

Modified: 
    openmp/runtime/test/tasking/omp_fill_taskqueue.c

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/test/tasking/omp_fill_taskqueue.c b/openmp/runtime/test/tasking/omp_fill_taskqueue.c
index 17e1de380bcb..24090a2f83bd 100644
--- a/openmp/runtime/test/tasking/omp_fill_taskqueue.c
+++ b/openmp/runtime/test/tasking/omp_fill_taskqueue.c
@@ -47,10 +47,14 @@ int main()
           // all tasks, and detect the test failure if it has not been done yet.
           if (failed < 0)
             failed = throttling ? enqueued == NUM_TASKS : enqueued < NUM_TASKS;
+#pragma omp atomic write
           block = 0;
         }
-        while (block)
-          ;
+        int wait = 0;
+        do {
+#pragma omp atomic read
+          wait = block;
+        } while (wait);
       }
     }
     block = 0;


        


More information about the Openmp-commits mailing list