C++: simplify output from suggest_alternatives_for
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / declare-2.c
blobd212458dada960847694a2b06278f9dfcf5ed224
1 #include <stdlib.h>
3 #define N 16
5 float c[N];
6 #pragma acc declare device_resident (c)
8 #pragma acc routine
9 float
10 subr2 (float a)
12 int i;
14 for (i = 0; i < N; i++)
15 c[i] = 2.0;
17 for (i = 0; i < N; i++)
18 a += c[i];
20 return a;
23 float b[N];
24 #pragma acc declare copyin (b)
26 #pragma acc routine
27 float
28 subr1 (float a)
30 int i;
32 for (i = 0; i < N; i++)
33 a += b[i];
35 return a;
38 int
39 main (int argc, char **argv)
41 float a;
42 int i;
44 for (i = 0; i < 16; i++)
45 b[i] = 1.0;
47 a = 0.0;
49 a = subr1 (a);
51 if (a != 16.0)
52 abort ();
54 a = 0.0;
56 a = subr2 (a);
58 if (a != 32.0)
59 abort ();
61 return 0;