OSDN Git Service

PR middle-end/25261
[pf3gnuchains/gcc-fork.git] / libgomp / testsuite / libgomp.c / nestedfn-5.c
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3
4 extern void abort (void);
5
6 void
7 foo (int *j)
8 {
9   int i = 5;
10   int bar (void) { return i + 1; }
11 #pragma omp sections
12   {
13     #pragma omp section
14       {
15         if (bar () != 6)
16         #pragma omp atomic
17           ++*j;
18       }
19     #pragma omp section
20       {
21         if (bar () != 6)
22         #pragma omp atomic
23           ++*j;
24       }
25   }
26 }
27
28 int
29 main (void)
30 {
31   int j = 0;
32 #pragma omp parallel num_threads (2)
33   foo (&j);
34   if (j)
35     abort ();
36   return 0;
37 }
38