sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.c / vla-1.c
blobbdacdbbe8836e3bd2695951465a6341ae95a6f2c
1 /* { dg-do run } */
3 #include <omp.h>
4 #include <stdlib.h>
5 #include <string.h>
7 int
8 main (int argc, char **argv[])
10 int n = argc < 5 ? 12 : 31, i, m, l;
11 char a[n + 3];
12 unsigned short b[n / 2 - 1];
13 int c[n * 2 + 1];
15 for (i = 0; i < n + 3; i++)
16 a[i] = i;
17 for (i = 0; i < n / 2 - 1; i++)
18 b[i] = (i << 8) | i;
19 for (i = 0; i < n * 2 + 1; i++)
20 c[i] = (i << 24) | i;
21 l = 0;
22 m = n;
23 #pragma omp parallel default (shared) num_threads (4) \
24 firstprivate (a, m) private (b, i) reduction (+:l)
26 for (i = 0; i < m + 3; i++)
27 if (a[i] != i)
28 l++;
29 for (i = 0; i < m * 2 + 1; i++)
30 if (c[i] != ((i << 24) | i))
31 l++;
32 #pragma omp barrier
33 memset (a, omp_get_thread_num (), m + 3);
34 for (i = 0; i < m / 2 - 1; i++)
35 b[i] = a[0] + 7;
36 #pragma omp master
38 for (i = 0; i < m * 2 + 1; i++)
39 c[i] = a[0] + 16;
41 #pragma omp barrier
42 if (a[0] != omp_get_thread_num ())
43 l++;
44 for (i = 1; i < m + 3; i++)
45 if (a[i] != a[0])
46 l++;
47 for (i = 0; i < m / 2 - 1; i++)
48 if (b[i] != a[0] + 7)
49 l++;
50 for (i = 0; i < m * 2 + 1; i++)
51 if (c[i] != 16)
52 l++;
54 if (l)
55 abort ();
56 for (i = 0; i < n * 2 + 1; i++)
57 if (c[i] != 16)
58 l++;
59 return 0;