]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c
[Patch AArch64] Fixup floating point division with -march=armv8-a+nosimd
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / cilk-plus / CK / spawning_arg.c
CommitLineData
572f8300 1/* { dg-do run } */
2/* { dg-require-effective-target cilkplus_runtime } */
d037099f 3/* { dg-options "-fcilkplus" } */
d037099f 4
4abd9410 5#ifdef __cplusplus
6extern "C" {
7#endif
8
9extern int __cilkrts_set_param (const char *, const char *);
10
11#ifdef __cplusplus
12}
13#endif
14
15
d037099f 16void f0(volatile int *steal_flag)
17{
18 int i = 0;
19 /* Wait for steal_flag to be set */
20 while (!*steal_flag)
21 ;
22}
23
24int f1()
25{
26
27 volatile int steal_flag = 0;
28 _Cilk_spawn f0(&steal_flag);
29 steal_flag = 1; // Indicate stolen
30 _Cilk_sync;
31 return 0;
32}
33
34void f2(int q)
35{
36 q = 5;
37}
38
39void f3()
40{
41 _Cilk_spawn f2(f1());
42}
43
44int main()
45{
4abd9410 46 /* Ensure more than one worker. */
47 if (__cilkrts_set_param("nworkers", "2") != 0)
48 __builtin_abort();
49
d037099f 50 f3();
51 return 0;
52}