[Openmp-commits] [PATCH] D21842: Fix omp_sections_nowait.c test to address Bugzilla Bug 28336

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Wed Jun 29 10:54:21 PDT 2016


AndreyChurbanov added a subscriber: AndreyChurbanov.

================
Comment at: test/worksharing/sections/omp_sections_nowait.c:23
@@ +22,3 @@
+    " and waits.\n", rank);
+  while (release == 0);
+  #pragma omp atomic
----------------
hfinkel wrote:
> I don't recall how this part of OpenMP's memory model is specified. Do you technically need an omp flush(release) here too to force this thread to synchronize its local memory view with the global one?
In theory all accesses to "release" variable are data races here. And flush won't change this.  So theoretically atomic reads/writes could help the test be absolutely correct.

But in practice these data races are benign, so I think it is OK to rely on compiler to honor volatile keyword and the fact that int type has all reads and writes atomic (unless you artificially align it on odd boundary).

So I would not introduce complication with omp atomic read/write for variable "release" now.

Just my 2 cents.



Repository:
  rL LLVM

http://reviews.llvm.org/D21842





More information about the Openmp-commits mailing list