Debian Codegraph @

gcc/testsuite/gcc.target/avr/torture/pr61443.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-std=gnu99" } */
3
4 #include <stdlib.h>
5 #include <stdarg.h>
6
7 #ifndef __FLASH
8 #define __flash /* empty */
9 #define __memx /* empty */
10 #endif
11
12 __extension__ typedef __int24 int24_t;
13
14 #define NC __attribute__((noipa))
15
16 void NC vfun (char n, ...)
17 {
18 va_list ap;
19
20 va_start (ap, n);
21
22 switch (n)
23 {
24 default:
25 abort();
26 case 1:
27 if (11 != va_arg (ap, int))
28 abort();
29 break;
30 case 2:
31 if (2222 != va_arg (ap, int))
32 abort();
33 break;
34 case 3:
35 if (333333 != va_arg (ap, int24_t))
36 abort();
37 break;
38 case 4:
39 if (44444444 != va_arg (ap, long))
40 abort();
41 break;
42 case 8:
43 if (8888888888888888 != va_arg (ap, long long))
44 abort();
45 break;
46 }
47
48 va_end (ap);
49 }
50
51
52 void NC boo_qi (const __flash char *p)
53 {
54 vfun (1, *p);
55 }
56
57 void NC boox_qi (const __memx char *p)
58 {
59 vfun (1, *p);
60 }
61
62 void NC boo_hi (const __flash int *p)
63 {
64 vfun (2, *p);
65 }
66
67 void NC boox_hi (const __memx int *p)
68 {
69 vfun (2, *p);
70 }
71
72 void NC boo_psi (const __flash int24_t *p)
73 {
74 vfun (3, *p);
75 }
76
77 void NC boox_psi (const __memx int24_t *p)
78 {
79 vfun (3, *p);
80 }
81
82 void NC boo_si (const __flash long *p)
83 {
84 vfun (4, *p);
85 }
86
87 void NC boox_si (const __memx long *p)
88 {
89 vfun (4, *p);
90 }
91
92 void NC boo_di (const __flash long long *p)
93 {
94 vfun (8, *p);
95 }
96
97 void NC boox_di (const __memx long long *p)
98 {
99 vfun (8, *p);
100 }
101
102 const __flash char f_qi = 11;
103 const __flash int f_hi = 2222;
104 const __flash int24_t f_psi = 333333;
105 const __flash long f_si = 44444444;
106 const __flash long long f_di = 8888888888888888;
107
108 const __memx char x_qi = 11;
109 const __memx int x_hi = 2222;
110 const __memx int24_t x_psi = 333333;
111 const __memx long x_si = 44444444;
112 const __memx long long x_di = 8888888888888888;
113
114 char r_qi = 11;
115 int r_hi = 2222;
116 int24_t r_psi = 333333;
117 long r_si = 44444444;
118 long long r_di = 8888888888888888;
119
120 int main (void)
121 {
122 boo_qi (&f_qi);
123 boo_hi (&f_hi);
124 boo_psi (&f_psi);
125 boo_si (&f_si);
126 boo_di (&f_di);
127
128 boox_qi (&x_qi);
129 boox_hi (&x_hi);
130 boox_psi (&x_psi);
131 boox_si (&x_si);
132 boox_di (&x_di);
133
134 boox_qi (&r_qi);
135 boox_hi (&r_hi);
136 boox_psi (&r_psi);
137 boox_si (&r_si);
138 boox_di (&r_di);
139
140 exit (0);
141 }