1// RUN: %libomp-compile && env KMP_ENABLE_TASK_THROTTLING=0 %libomp-run
2
3// This test is known to be fragile on NetBSD kernel at the moment,
4// https://bugs.llvm.org/show_bug.cgi?id=42020.
5// UNSUPPORTED: netbsd
6
7// Very flaky on openmp-clang-x86_64-linux-debian.
8// https://bugs.llvm.org/show_bug.cgi?id=45397
9// UNSUPPORTED: linux
10
11#include<omp.h>
12#include<stdlib.h>
13#include<string.h>
14
15// The first hashtable static size is 997
16#define NUM_DEPS 4000
17
18
19int main()
20{
21 int *deps = calloc(NUM_DEPS, size: sizeof(int));
22 int i;
23 int failed = 0;
24
25 #pragma omp parallel
26 #pragma omp master
27 {
28 for (i = 0; i < NUM_DEPS; i++) {
29 #pragma omp task firstprivate(i) depend(inout: deps[i])
30 {
31 deps[i] = 1;
32 }
33 #pragma omp task firstprivate(i) depend(inout: deps[i])
34 {
35 deps[i] = 2;
36 }
37 }
38 }
39
40 for (i = 0; i < NUM_DEPS; i++) {
41 if (deps[i] != 2)
42 failed++;
43 }
44
45 return failed;
46}
47

source code of openmp/runtime/test/tasking/omp_task_depend_resize_hashmap.c