Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/attr-vector_size.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
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" } */ | |
5 | |
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) | |
11 | |
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)) | |
17 | |
18 DEFVEC (extern, 27); | |
19 DEFVEC (extern, 28); | |
20 DEFVEC (extern, 29); | |
21 DEFVEC (extern, 30); | |
22 | |
23 #if __SIZEOF_SIZE_T__ > 4 | |
24 | |
25 DEFVEC (extern, 31); | |
26 DEFVEC (extern, 32); | |
27 DEFVEC (extern, 33); | |
28 DEFVEC (extern, 34); | |
29 DEFVEC (extern, 60); | |
30 DEFVEC (extern, 61); | |
31 DEFVEC (extern, 62); | |
32 | |
33 VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */ | |
34 | |
35 #else | |
36 | |
37 VEC (POW2 (31)) char v31; /* { dg-error "'vector_size' attribute argument value '2147483648' exceeds 2147483647" "ILP32" { target ilp32 } } */ | |
38 | |
39 VEC (POW2 (32)) char v32; /* { dg-error "'vector_size' attribute argument value '4294967296' exceeds 2147483647" "ILP32" { target ilp32 } } */ | |
40 | |
41 #endif | |
42 | |
43 void test_local_scope (void) | |
44 { | |
45 DEFVEC (auto, 27); | |
46 DEFVEC (auto, 28); | |
47 DEFVEC (auto, 29); | |
48 DEFVEC (auto, 30); | |
49 | |
50 #if __SIZEOF_SIZE_T__ > 4 | |
51 | |
52 DEFVEC (auto, 31); | |
53 DEFVEC (auto, 32); | |
54 DEFVEC (auto, 33); | |
55 DEFVEC (auto, 34); | |
56 DEFVEC (auto, 60); | |
57 DEFVEC (auto, 61); | |
58 DEFVEC (auto, 62); | |
59 | |
60 VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */ | |
61 | |
62 #else | |
63 | |
64 VEC (POW2 (31)) char v31; /* { dg-error "'vector_size' attribute argument value '2147483648' exceeds 2147483647" "ILP32" { target ilp32 } } */ | |
65 | |
66 VEC (POW2 (32)) char v32; /* { dg-error "'vector_size' attribute argument value '4294967296' exceeds 2147483647" "ILP32" { target ilp32 } } */ | |
67 | |
68 #endif | |
69 } |