* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
[official-gcc.git] / gcc / testsuite / gcc.dg / compat / vector-check.h
blob2d586d287d9fa153109729a65850a5e10accc599
1 #define TEST(NUM,TMODE,VAL) \
2 extern v##NUM##TMODE g_v##NUM##TMODE; \
3 extern TMODE g_##TMODE; \
5 extern void pass_v##NUM##TMODE (v##NUM##TMODE); \
6 extern v##NUM##TMODE return_v##NUM##TMODE (void); \
8 void \
9 checkp_##NUM##TMODE (TMODE *p) \
10 { \
11 int i; \
12 for (i = 0; i < NUM; i++) \
13 { \
14 if (p[i] != g_##TMODE + i) \
15 DEBUG_CHECK; \
16 } \
17 } \
19 void \
20 checkg_##NUM##TMODE (void) \
21 { \
22 u##NUM##TMODE u; \
23 TMODE *p = u.a; \
25 u.v = g_v##NUM##TMODE; \
26 checkp_##NUM##TMODE (p); \
27 } \
29 void \
30 init_##NUM##TMODE (void) \
31 { \
32 int i; \
33 u##NUM##TMODE u; \
34 g_##TMODE = VAL; \
35 for (i = 0; i < NUM; i++) \
36 u.a[i] = VAL + i; \
37 g_v##NUM##TMODE = u.v; \
38 } \
40 void \
41 test_v##NUM##TMODE (void) \
42 { \
43 v##NUM##TMODE v; \
44 u##NUM##TMODE u; \
45 TMODE *p = u.a; \
47 DEBUG_FPUTS ("v" #NUM #TMODE); \
48 DEBUG_NL; \
49 DEBUG_FPUTS (" global variable:"); \
50 init_##NUM##TMODE (); \
51 checkg_##NUM##TMODE (); \
52 DEBUG_NL; \
53 DEBUG_FPUTS (" pass global variable:"); \
54 pass_v##NUM##TMODE (g_v##NUM##TMODE); \
55 DEBUG_NL; \
56 DEBUG_FPUTS (" pass local variable:"); \
57 v = g_v##NUM##TMODE; \
58 pass_v##NUM##TMODE (v); \
59 DEBUG_NL; \
60 DEBUG_FPUTS (" function return:"); \
61 u.v = return_v##NUM##TMODE (); \
62 checkp_##NUM##TMODE (p); \
63 DEBUG_NL; \