Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / attr-vector_size.c
blob9177e25250a27871dccb20a09a64250a7b9b395f
1 /* PR middle-end/89797 - ICE on a vector_size (1LU << 33) int variable
2 PR c/89798 - excessive vector_size silently accepted and truncated
3 { dg-do compile { target int32plus } }
4 { dg-options "-Wall -Wno-unused" } */
6 #define ASSERT(e) _Static_assert (e, #e)
7 #define VEC(N) __attribute__ ((vector_size (N)))
8 #define POW2(N) (1LLU << N)
9 #define CAT(a, b) a ## b
10 #define CONCAT(a, b) CAT (a, b)
12 #define DEFVEC(storage, N) \
13 typedef VEC (POW2 (N)) char CONCAT (Vec, N); \
14 storage CONCAT (Vec, N) CONCAT (v, N); \
15 ASSERT (sizeof (CONCAT (Vec, N)) == POW2 (N)); \
16 ASSERT (sizeof (CONCAT (v, N)) == POW2 (N))
18 DEFVEC (extern, 27);
19 DEFVEC (extern, 28);
20 DEFVEC (extern, 29);
21 DEFVEC (extern, 30);
23 #if __SIZEOF_SIZE_T__ > 4
25 VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "not-ILP32" { target { ! ilp32 } } } */
27 #else
29 VEC (POW2 (31)) char v31; /* { dg-error "'vector_size' attribute argument value '2147483648' exceeds 2147483647" "ILP32" { target ilp32 } } */
31 VEC (POW2 (32)) char v32; /* { dg-error "'vector_size' attribute argument value '4294967296' exceeds 2147483647" "ILP32" { target ilp32 } } */
33 #endif
35 void test_local_scope (void)
37 DEFVEC (auto, 27);
38 DEFVEC (auto, 28);
39 DEFVEC (auto, 29);
40 DEFVEC (auto, 30);
42 #if __SIZEOF_SIZE_T__ > 4
44 VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "not-ILP32" { target { ! ilp32 } } } */
46 #else
48 VEC (POW2 (31)) char v31; /* { dg-error "'vector_size' attribute argument value '2147483648' exceeds 2147483647" "ILP32" { target ilp32 } } */
50 VEC (POW2 (32)) char v32; /* { dg-error "'vector_size' attribute argument value '4294967296' exceeds 2147483647" "ILP32" { target ilp32 } } */
52 #endif