Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713...
[gcc.git] / libgomp / testsuite / libgomp.c / task-1.c
blobd17c3c61c2f78180c65abe08ab10e68756febc9c
1 extern void abort (void);
3 int a = 18;
5 void
6 f1 (int i, int j, int k)
8 int l = 6, m = 7, n = 8;
9 #pragma omp task private(j, m) shared(k, n)
11 j = 6;
12 m = 5;
13 if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9)
14 #pragma omp atomic
15 k++;
17 #pragma omp taskwait
18 if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9)
19 abort ();
22 int v1 = 1, v2 = 2, v5 = 5;
23 int e;
25 void
26 f2 (void)
28 int v3 = 3;
29 #pragma omp sections private (v1) firstprivate (v2)
31 #pragma omp section
33 int v4 = 4;
34 v1 = 7;
35 #pragma omp task
37 if (++v1 != 8 || ++v2 != 3 || ++v3 != 4 || ++v4 != 5 || ++v5 != 6)
38 e = 1;
40 #pragma omp taskwait
41 if (v1 != 7 || v2 != 2 || v3 != 3 || v4 != 4 || v5 != 6)
42 abort ();
43 if (e)
44 abort ();
49 void
50 f3 (int i, int j, int k)
52 int l = 6, m = 7, n = 8;
53 #pragma omp task private(j, m) shared(k, n) untied
55 j = 6;
56 m = 5;
57 if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9)
58 #pragma omp atomic
59 k++;
61 #pragma omp taskwait
62 if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9)
63 abort ();
66 int
67 main (void)
69 f1 (8, 26, 0);
70 f2 ();
71 a = 18;
72 f3 (8, 26, 0);
73 a = 18;
74 #pragma omp parallel num_threads(4)
76 #pragma omp master
78 f1 (8, 26, 0);
79 a = 18;
80 f3 (8, 26, 0);
83 return 0;