Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/pr103642.c

raw
1 /* PR middle-end/103642 */
2 /* { dg-do compile } */
3 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
4
5 #include <stdlib.h>
6
7 typedef struct
8 {
9 int *a;
10 } S;
11
12 typedef struct
13 {
14 S *s;
15 int *ptr;
16 } T;
17
18 #define N 10
19
20 int main (void)
21 {
22 T t;
23 t.s = (S *) malloc (sizeof (S));
24 t.s->a = (int *) malloc (sizeof(int) * N);
25
26 #pragma omp target map(from: t.s->a[:N])
27 {
28 t.s->a[0] = 1;
29 }
30
31 free (t.s->a);
32 free (t.s);
33
34 return 0;
35 }