Debian Codegraph @

libgomp/testsuite/libgomp.c/nestedfn-5.c

raw
1 /* { dg-do run } */
2
3 extern void abort (void);
4
5 void
6 foo (int *j)
7 {
8 int i = 5;
9 int bar (void) { return i + 1; }
10 #pragma omp sections
11 {
12 #pragma omp section
13 {
14 if (bar () != 6)
15 #pragma omp atomic
16 ++*j;
17 }
18 #pragma omp section
19 {
20 if (bar () != 6)
21 #pragma omp atomic
22 ++*j;
23 }
24 }
25 }
26
27 int
28 main (void)
29 {
30 int j = 0;
31 #pragma omp parallel num_threads (2)
32 foo (&j);
33 if (j)
34 abort ();
35 return 0;
36 }
37