| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -Wno-psabi" } */ |
| 3 |
/* { dg-additional-options "-std=c23" { target c } } */ |
| 4 |
|
| 5 |
unsigned char a[] = { |
| 6 |
#embed __FILE__ |
| 7 |
}; |
| 8 |
const unsigned char b[] = { |
| 9 |
#embed __FILE__ |
| 10 |
}; |
| 11 |
unsigned char c[] = { |
| 12 |
0, 1, 2, 3, 4, 5, 6, 7, |
| 13 |
#embed __FILE__ limit(128) suffix (,) |
| 14 |
#embed __FILE__ limit(128) suffix (,) |
| 15 |
#embed __FILE__ |
| 16 |
}; |
| 17 |
const unsigned char d[] = { |
| 18 |
0, 1, 2, 3, 4, 5, 6, 7, |
| 19 |
#embed __FILE__ limit(128) suffix (,) |
| 20 |
#embed __FILE__ limit(128) suffix (,) |
| 21 |
#embed __FILE__ |
| 22 |
}; |
| 23 |
typedef char V __attribute__((vector_size (16), may_alias)); |
| 24 |
struct __attribute__((may_alias)) S { int a, b, c, d; }; |
| 25 |
|
| 26 |
__attribute__((noipa)) int |
| 27 |
foo (V x, V y) |
| 28 |
{ |
| 29 |
return __builtin_memcmp (&x, &y, sizeof (x)); |
| 30 |
} |
| 31 |
|
| 32 |
__attribute__((noipa)) int |
| 33 |
bar (struct S x, struct S y) |
| 34 |
{ |
| 35 |
return x.a != y.a || x.b != y.b || x.c != y.c || x.d != y.d; |
| 36 |
} |
| 37 |
|
| 38 |
int |
| 39 |
main () |
| 40 |
{ |
| 41 |
if (a[0] != b[0] |
| 42 |
|| a[42] != b[42] |
| 43 |
|| a[sizeof (a) - 5] != b[sizeof (a) - 5] |
| 44 |
|| a[sizeof (a) - 1] != b[sizeof (a) - 1]) |
| 45 |
__builtin_abort (); |
| 46 |
if (foo (((V *) a)[0], ((V *) b)[0]) |
| 47 |
|| foo (((V *) a)[1], ((V *) b)[1]) |
| 48 |
|| foo (((V *) c)[8], ((V *) d)[8]) |
| 49 |
|| foo (((V *) c)[9], ((V *) d)[9])) |
| 50 |
__builtin_abort (); |
| 51 |
if (bar (((struct S *) a)[0], ((struct S *) b)[0]) |
| 52 |
|| bar (((struct S *) a)[1], ((struct S *) b)[1]) |
| 53 |
|| bar (((struct S *) c)[8], ((struct S *) d)[8]) |
| 54 |
|| bar (((struct S *) c)[9], ((struct S *) d)[9])) |
| 55 |
__builtin_abort (); |
| 56 |
} |