diff options
author | Joachim Protze <protze@itc.rwth-aachen.de> | 2021-10-15 17:16:07 +0200 |
---|---|---|
committer | Joachim Protze <protze@itc.rwth-aachen.de> | 2021-10-15 17:32:05 +0200 |
commit | 26b675d65eb2d1f117a39eee965652f590373232 (patch) | |
tree | 9deb2cb85da86e7e056fcc7b7f1174111eab76b4 | |
parent | cef9978027cf4affde7ae3e4a3389053615bca60 (diff) | |
download | llvm-26b675d65eb2d1f117a39eee965652f590373232.zip llvm-26b675d65eb2d1f117a39eee965652f590373232.tar.gz llvm-26b675d65eb2d1f117a39eee965652f590373232.tar.bz2 |
[OpenMP][Tools][NFC] Make an Archer test more robust
The execution order of the tasks is not fixed, so there is no ordering
for the write accesses. Enforce the ordering that is expected in the check.
-rw-r--r-- | openmp/tools/archer/tests/races/task-dependency.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/openmp/tools/archer/tests/races/task-dependency.c b/openmp/tools/archer/tests/races/task-dependency.c index 664dd49..f6496ac 100644 --- a/openmp/tools/archer/tests/races/task-dependency.c +++ b/openmp/tools/archer/tests/races/task-dependency.c @@ -19,15 +19,16 @@ #include <unistd.h> int main(int argc, char *argv[]) { - int var = 0, a = 0; + int var = 0, a = 0, b = 0; #pragma omp parallel num_threads(8) shared(var, a) #pragma omp master { -#pragma omp task shared(var, a) depend(out : var) +#pragma omp task shared(var, a, b) depend(out : var) { OMPT_SIGNAL(a); var++; + OMPT_SIGNAL(b); } #pragma omp task shared(a) depend(in : var) @@ -36,8 +37,9 @@ int main(int argc, char *argv[]) { OMPT_WAIT(a, 3); } -#pragma omp task shared(var) // depend(in: var) is missing here! +#pragma omp task shared(var, b) // depend(in: var) is missing here! { + OMPT_WAIT(b, 1); var++; OMPT_SIGNAL(a); } @@ -53,7 +55,7 @@ int main(int argc, char *argv[]) { // CHECK: WARNING: ThreadSanitizer: data race // CHECK-NEXT: {{(Write|Read)}} of size 4 -// CHECK-NEXT: #0 {{.*}}task-dependency.c:41 +// CHECK-NEXT: #0 {{.*}}task-dependency.c:43 // CHECK: Previous write of size 4 // CHECK-NEXT: #0 {{.*}}task-dependency.c:30 // CHECK: DONE |