Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.c / pr81778.c
blob571668eb36a96ce8290a677f7d5ae8e4bb5a86db
1 /* Minimized from for-5.c. */
3 #include <stdio.h>
4 #include <stdlib.h>
6 /* Size of array we want to write. */
7 #define N 32
9 /* Size of extra space before and after. */
10 #define CANARY_SIZE (N * 32)
12 /* Start of array we want to write. */
13 #define BASE (CANARY_SIZE)
15 // Total size to be allocated.
16 #define ALLOC_SIZE (CANARY_SIZE + N + CANARY_SIZE)
18 #pragma omp declare target
19 int a[ALLOC_SIZE];
20 #pragma omp end declare target
22 int
23 main (void)
25 /* Use variable step in for loop. */
26 int s = 1;
28 #pragma omp target update to(a)
30 /* Write a[BASE] .. a[BASE + N - 1]. */
31 #pragma omp target simd
32 for (int i = N - 1; i > -1; i -= s)
33 a[BASE + i] = 1;
35 #pragma omp target update from(a)
37 for (int i = 0; i < ALLOC_SIZE; i++)
39 int expected = (BASE <= i && i < BASE + N) ? 1 : 0;
40 if (a[i] == expected)
41 continue;
43 printf ("Expected %d, got %d at base[%d]\n", expected, a[i], i - BASE);
44 abort ();
47 return 0;