| 1 |
/* { dg-options "-msve-vector-bits=256 -W -Wall" } */ |
| 2 |
|
| 3 |
#include <arm_sve.h> |
| 4 |
|
| 5 |
#define N __ARM_FEATURE_SVE_BITS |
| 6 |
#define FIXED_ATTR __attribute__ ((arm_sve_vector_bits (N))) |
| 7 |
#define ALIGNED_ATTR __attribute__((aligned(N / 8))) |
| 8 |
|
| 9 |
typedef svint8_t var1; |
| 10 |
typedef __SVInt8_t var2; |
| 11 |
|
| 12 |
typedef const var1 const_var1; |
| 13 |
typedef const var2 const_var2; |
| 14 |
|
| 15 |
typedef var1 aligned_var1 ALIGNED_ATTR; |
| 16 |
typedef var2 aligned_var2 ALIGNED_ATTR; |
| 17 |
|
| 18 |
typedef var1 fixed1 FIXED_ATTR; |
| 19 |
typedef var1 fixed1_alias FIXED_ATTR; |
| 20 |
typedef var2 fixed2 FIXED_ATTR; |
| 21 |
|
| 22 |
typedef const_var1 const_fixed1 FIXED_ATTR; |
| 23 |
typedef const var1 const_fixed1_alias FIXED_ATTR; |
| 24 |
typedef const_var2 const_fixed2 FIXED_ATTR; |
| 25 |
|
| 26 |
typedef aligned_var1 aligned_fixed1 FIXED_ATTR; |
| 27 |
typedef var1 aligned_fixed1_alias FIXED_ATTR ALIGNED_ATTR; |
| 28 |
typedef aligned_var2 aligned_fixed2 FIXED_ATTR; |
| 29 |
|
| 30 |
extern fixed1 extern1; |
| 31 |
extern fixed1_alias extern1_alias; |
| 32 |
extern fixed2 extern2; |
| 33 |
|
| 34 |
extern const_fixed1 const_extern1; |
| 35 |
extern const_fixed1_alias const_extern1_alias; |
| 36 |
extern const_fixed2 const_extern2; |
| 37 |
|
| 38 |
fixed1 *ptr1a = &extern1; |
| 39 |
fixed1_alias *ptr1b = &extern1; |
| 40 |
fixed2 *ptr1c = &extern1; |
| 41 |
|
| 42 |
fixed1 *ptr2a = &extern1_alias; |
| 43 |
fixed1_alias *ptr2b = &extern1_alias; |
| 44 |
fixed2 *ptr2c = &extern1_alias; |
| 45 |
|
| 46 |
fixed1 *ptr3a = &extern2; |
| 47 |
fixed1_alias *ptr3b = &extern2; |
| 48 |
fixed2 *ptr3c = &extern2; |
| 49 |
|
| 50 |
fixed1 *ptr4a = &const_extern1; // { dg-error {invalid conversion} "c++" { target c++ } } |
| 51 |
// { dg-warning {discards 'const' qualifier} "c" { target c } .-1 } |
| 52 |
fixed1_alias *ptr4b = &const_extern1; // { dg-error {invalid conversion} "c++" { target c++ } } |
| 53 |
// { dg-warning {discards 'const' qualifier} "c" { target c } .-1 } |
| 54 |
fixed2 *ptr4c = &const_extern1; // { dg-error {invalid conversion} "c++" { target c++ } } |
| 55 |
// { dg-warning {discards 'const' qualifier} "c" { target c } .-1 } |
| 56 |
|
| 57 |
const fixed1 *ptr5a = &const_extern2; |
| 58 |
const fixed1_alias *ptr5b = &const_extern2; |
| 59 |
const fixed2 *ptr5c = &const_extern2; |
| 60 |
|
| 61 |
const_fixed1 *const_ptr1a = &extern1; |
| 62 |
const_fixed1_alias *const_ptr1b = &extern1; |
| 63 |
const_fixed2 *const_ptr1c = &extern1; |
| 64 |
|
| 65 |
const_fixed1 *const_ptr2a = &extern1_alias; |
| 66 |
const_fixed1_alias *const_ptr2b = &extern1_alias; |
| 67 |
const_fixed2 *const_ptr2c = &extern1_alias; |
| 68 |
|
| 69 |
const_fixed1 *const_ptr3a = &extern2; |
| 70 |
const_fixed1_alias *const_ptr3b = &extern2; |
| 71 |
const_fixed2 *const_ptr3c = &extern2; |
| 72 |
|
| 73 |
const_fixed1 *const_ptr4a = &const_extern1; |
| 74 |
const_fixed1_alias *const_ptr4b = &const_extern1; |
| 75 |
const_fixed2 *const_ptr4c = &const_extern1; |
| 76 |
|
| 77 |
const_fixed1 *const_ptr5a = &const_extern1_alias; |
| 78 |
const_fixed1_alias *const_ptr5b = &const_extern1_alias; |
| 79 |
const_fixed2 *const_ptr5c = &const_extern1_alias; |
| 80 |
|
| 81 |
const_fixed1 *const_ptr6a = &const_extern2; |
| 82 |
const_fixed1_alias *const_ptr6b = &const_extern2; |
| 83 |
const_fixed2 *const_ptr6c = &const_extern2; |
| 84 |
|
| 85 |
struct normal1 { int x; fixed1 y; }; |
| 86 |
struct normal1_alias { int x; fixed1_alias y; }; |
| 87 |
struct normal2 { int x; fixed2 y; }; |
| 88 |
|
| 89 |
struct aligned1 { int x; aligned_fixed1 y; }; |
| 90 |
struct aligned1_alias { int x; aligned_fixed1_alias y; }; |
| 91 |
struct aligned2 { int x; aligned_fixed2 y; }; |
| 92 |
|
| 93 |
#define ASSERT(NAME, TEST) typedef int NAME[(TEST) ? 1 : -1] |
| 94 |
|
| 95 |
ASSERT (check_normal1, sizeof (struct normal1) == N / 8 + 16); |
| 96 |
ASSERT (check_normal1_alias, sizeof (struct normal1_alias) == N / 8 + 16); |
| 97 |
ASSERT (check_normal2, sizeof (struct normal2) == N / 8 + 16); |
| 98 |
|
| 99 |
ASSERT (check_aligned1, sizeof (struct aligned1) == N / 4); |
| 100 |
ASSERT (check_aligned1_alias, sizeof (struct aligned1_alias) == N / 4); |
| 101 |
ASSERT (check_aligned2, sizeof (struct aligned2) == N / 4); |