aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/bad-array-section-c-3.c
blob: 431af71c42224470dc9e9884a027934b13d1be8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do compile } */

struct S {
  signed char *ptr;
};

int main()
{
  signed char arr[20];

  /* Reject array section in compound initialiser.  */
#pragma omp target map( (struct S) { .ptr = (signed char *) arr[5:5] } )
/* { dg-error {expected '\]' before ':' token} "" { target *-*-* } .-1 } */
/* { dg-warning {cast to pointer from integer of different size} "" { target *-*-* } .-2 } */
/* { dg-message {sorry, unimplemented: unsupported map expression} "" { target *-*-* } .-3 } */
  { }

  /* ...and this is unsupported too (probably not useful anyway).  */
#pragma omp target map( (struct S) { .ptr = &arr[5] } )
/* { dg-message {sorry, unimplemented: unsupported map expression} "" { target *-*-* } .-1 } */
  { }

  return 0;
}