1 /* { dg-additional-options "-O2" } */
2 /* { dg-additional-options "-fipa-pta -fdump-tree-optimized" } */
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 typedef __SIZE_TYPE__ size_t;
8 void *malloc (size_t);
9 void free (void *);
10 #ifdef __cplusplus
11 }
12 #endif
13 
14 #define N 2
15 
16 void
foo(void)17 foo (void)
18 {
19   unsigned int *a = (unsigned int *)malloc (N * sizeof (unsigned int));
20   unsigned int *b = a;
21   unsigned int *c = (unsigned int *)malloc (N * sizeof (unsigned int));
22 
23 #pragma acc kernels pcopyout (a[0:N], b[0:N], c[0:N])
24   {
25     a[0] = 0;
26     b[0] = 1;
27     c[0] = a[0];
28   }
29 
30   free (a);
31   free (c);
32 }
33 
34 /* { dg-final { scan-tree-dump-times "(?n)= 0;$" 1 "optimized" } } */
35 /* { dg-final { scan-tree-dump-times "(?n)= 1;$" 1 "optimized" } } */
36 /* { dg-final { scan-tree-dump-times "(?n)= \\*a" 1 "optimized" } } */
37