* ipa-cp.c (ipcp_cloning_candidate_p): Use node->optimize_for_size_p.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20010122-1.c
blob4eeb8c7a30bd556ac8a01970164ceb6690da1c6e
1 /* { dg-skip-if "requires frame pointers" { *-*-* } "-fomit-frame-pointer" "" } */
2 /* { dg-require-effective-target return_address } */
4 extern void exit (int);
5 extern void abort (void);
6 extern void *alloca (__SIZE_TYPE__);
7 char *dummy (void);
9 #define NOINLINE __attribute__((noinline)) __attribute__ ((noclone))
11 void *save_ret1[6];
12 void *test4a (char *);
13 void *test5a (char *);
14 void *test6a (char *);
16 void NOINLINE *test1 (void)
18 void * temp;
19 temp = __builtin_return_address (0);
20 return temp;
23 void NOINLINE *test2 (void)
25 void * temp;
26 dummy ();
27 temp = __builtin_return_address (0);
28 return temp;
31 void NOINLINE *test3 (void)
33 void * temp;
34 temp = __builtin_return_address (0);
35 dummy ();
36 return temp;
39 void NOINLINE *test4 (void)
41 char * save = (char*) alloca (4);
43 return test4a (save);
46 void *NOINLINE test4a (char * p)
48 void * temp;
49 temp = __builtin_return_address (1);
50 return temp;
53 void NOINLINE *test5 (void)
55 char * save = (char*) alloca (4);
57 return test5a (save);
60 void NOINLINE *test5a (char * p)
62 void * temp;
63 dummy ();
64 temp = __builtin_return_address (1);
65 return temp;
68 void NOINLINE *test6 (void)
70 char * save = (char*) alloca (4);
72 return test6a (save);
75 void NOINLINE *test6a (char * p)
77 void * temp;
78 temp = __builtin_return_address (1);
79 dummy ();
80 return temp;
83 void *(*func1[6])(void) = { test1, test2, test3, test4, test5, test6 };
85 char * NOINLINE call_func1 (int i)
87 save_ret1[i] = func1[i] ();
90 static void *ret_addr;
91 void *save_ret2[6];
92 void test10a (char *);
93 void test11a (char *);
94 void test12a (char *);
96 void NOINLINE test7 (void)
98 ret_addr = __builtin_return_address (0);
99 return;
102 void NOINLINE test8 (void)
104 dummy ();
105 ret_addr = __builtin_return_address (0);
106 return;
109 void NOINLINE test9 (void)
111 ret_addr = __builtin_return_address (0);
112 dummy ();
113 return;
116 void NOINLINE test10 (void)
118 char * save = (char*) alloca (4);
120 test10a (save);
123 void NOINLINE test10a (char * p)
125 ret_addr = __builtin_return_address (1);
126 return;
129 void NOINLINE test11 (void)
131 char * save = (char*) alloca (4);
133 test11a (save);
136 void NOINLINE test11a (char * p)
138 dummy ();
139 ret_addr = __builtin_return_address (1);
140 return;
143 void NOINLINE test12 (void)
145 char * save = (char*) alloca (4);
147 test12a (save);
150 void NOINLINE test12a (char * p)
152 ret_addr = __builtin_return_address (1);
153 dummy ();
154 return;
157 char * dummy (void)
159 char * save = (char*) alloca (4);
161 return save;
164 void (*func2[6])(void) = { test7, test8, test9, test10, test11, test12 };
166 void NOINLINE call_func2 (int i)
168 func2[i] ();
169 save_ret2[i] = ret_addr;
172 int main (void)
174 int i;
176 for (i = 0; i < 6; i++) {
177 call_func1(i);
180 if (save_ret1[0] != save_ret1[1]
181 || save_ret1[1] != save_ret1[2])
182 abort ();
183 if (save_ret1[3] != save_ret1[4]
184 || save_ret1[4] != save_ret1[5])
185 abort ();
186 if (save_ret1[3] && save_ret1[0] != save_ret1[3])
187 abort ();
190 for (i = 0; i < 6; i++) {
191 call_func2(i);
194 if (save_ret2[0] != save_ret2[1]
195 || save_ret2[1] != save_ret2[2])
196 abort ();
197 if (save_ret2[3] != save_ret2[4]
198 || save_ret2[4] != save_ret2[5])
199 abort ();
200 if (save_ret2[3] && save_ret2[0] != save_ret2[3])
201 abort ();
203 exit (0);