LLVM OpenMP
20.0.0git
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
c
d
e
g
h
i
m
n
p
r
s
t
u
Functions
c
d
e
g
i
m
n
p
r
s
u
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
i
k
l
m
n
o
p
r
t
u
Enumerations
_
b
c
d
f
k
l
n
o
s
t
Enumerator
_
a
b
c
d
e
f
k
l
n
o
p
r
s
t
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
tools
archer
tests
races
taskwait-depend.c
Go to the documentation of this file.
1
/*
2
* taskwait-depend.c -- Archer testcase
3
* derived from DRB165-taskdep4-orig-omp50-yes.c in DataRaceBench
4
*/
5
//===----------------------------------------------------------------------===//
6
//
7
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8
//
9
// See tools/archer/LICENSE.txt for details.
10
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11
//
12
//===----------------------------------------------------------------------===//
13
14
// RUN: %libarcher-compile-and-run-race | FileCheck %s
15
// RUN: %libarcher-compile-and-run-race-noserial | FileCheck %s
16
// REQUIRES: tsan
17
18
#include "ompt/ompt-signal.h"
19
#include <omp.h>
20
#include <stdio.h>
21
22
void
foo
() {
23
24
int
x = 0, y = 2, sem = 0;
25
26
#pragma omp task depend(inout : x) shared(x, sem)
27
{
28
OMPT_SIGNAL
(sem);
29
x++;
// 1st Child Task
30
}
31
32
#pragma omp task shared(y, sem)
33
{
34
OMPT_SIGNAL
(sem);
35
y--;
// 2nd child task
36
}
37
38
OMPT_WAIT
(sem, 2);
39
#pragma omp taskwait depend(in : x)
// 1st taskwait
40
41
printf(
"x=%d\n"
, x);
42
printf(
"y=%d\n"
, y);
43
#pragma omp taskwait
// 2nd taskwait
44
}
45
46
int
main
() {
47
#pragma omp parallel num_threads(2)
48
#pragma omp single
49
foo
();
50
51
return
0;
52
}
53
54
// CHECK: WARNING: ThreadSanitizer: data race
55
// CHECK-NEXT: {{(Write|Read)}} of size 4
56
// CHECK-NEXT: #0 {{.*}}taskwait-depend.c:42
57
// CHECK: Previous write of size 4
58
// CHECK-NEXT: #0 {{.*}}taskwait-depend.c:35
59
// CHECK: ThreadSanitizer: reported {{[0-9]+}} warnings
OMPT_WAIT
#define OMPT_WAIT(s, v)
Definition:
ompt-signal.h:20
OMPT_SIGNAL
#define OMPT_SIGNAL(s)
Definition:
ompt-signal.h:12
main
int main()
Definition:
taskwait-depend.c:16
foo
void foo()
Definition:
taskwait-depend.c:22
Generated on Mon Jun 16 2025 04:18:24 for LLVM OpenMP by
1.9.6