aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr96377-5.c
blob: 3d0c24befa67c1ca82a3ad5232374c7f84485716 (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
25
26
27
28
29
30
31
32
33
/* { dg-do compile { target aarch64*-*-* } } */
/* { dg-options "-fno-lax-vector-conversions" } */
/* { dg-message "use '-flax-vector-conversions' to permit conversions" "" { target *-*-* } 0 } */

typedef int v4si __attribute__((vector_size(16)));
typedef short v8hi __attribute__((vector_size(16)));

struct s { __Int16x8_t x; __Int32x4_t y; };
union u1 { __Int16x8_t x; __Int32x4_t y; };
union u2 { __Int32x4_t s; __Int16x8_t y; };

void
foo (v4si i, v8hi h)
{
  struct s x1 = { i, i }; // { dg-error "incompatible types when initializing type '__Int16x8_t" }
  struct s x2 = { h, h }; // { dg-error "incompatible types" }
  struct s x3 = { i, h }; // { dg-error "incompatible types" }
  struct s x4 = { h, i };

  union u1 y1 = { i }; // { dg-error "incompatible types" }
  union u1 y2 = { h };
  union u2 y3 = { i };
  union u2 y4 = { h }; // { dg-error "incompatible types" }

  v4si z1[] = { i, i };
  v4si z2[] = { i, h }; // { dg-error "incompatible types" }
  v4si z3[] = { h, i }; // { dg-error "incompatible types" }
  v4si z4[] = { h, h }; // { dg-error "incompatible types" }
  v8hi z5[] = { i, i }; // { dg-error "incompatible types" }
  v8hi z6[] = { i, h }; // { dg-error "incompatible types" }
  v8hi z7[] = { h, i }; // { dg-error "incompatible types" }
  v8hi z8[] = { h, h };
}