repo.or.cz
/
gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
AVR: Assert minimal required bit width of section_common::flags.
[gcc.git]
/
libgomp
/
testsuite
/
libgomp.c
/
task-6.c
blob
e5fc758d2834c1e8167d83b27dc46e4a3ca17d6c
1
#include <stdlib.h>
2
#include <unistd.h>
3
4
int
5
main
()
6
{
7
int
x
=
0
,
y
=
0
;
8
#pragma omp parallel shared(x, y)
9
#pragma omp master
10
{
11
#pragma omp task depend(out:y) shared(x, y)
12
{
13
sleep
(
1
);
14
x
=
1
;
15
y
=
1
;
16
}
17
#pragma omp task depend(inout:y) shared(x, y)
18
{
19
if
(
x
!=
1
||
y
!=
1
)
20
abort
();
21
y
++;
22
}
23
}
24
if
(
x
!=
1
||
y
!=
2
)
25
abort
();
26
x
=
0
;
27
y
=
0
;
28
#pragma omp parallel
29
#pragma omp master
30
{
31
#pragma omp task depend(out:y)
32
{
33
sleep
(
1
);
34
x
=
1
;
35
y
=
1
;
36
}
37
#pragma omp task depend(inout:y)
38
{
39
if
(
x
!=
1
||
y
!=
1
)
40
abort
();
41
y
++;
42
}
43
}
44
if
(
x
!=
1
||
y
!=
2
)
45
abort
();
46
return
0
;
47
}