16 for(i
=0;i
<TAB_SIZE
;i
++) {
26 for(i
=0;i
<TAB_SIZE
+ 1;i
++) {
32 /* actually, profiling test */
39 for(it
=0;it
<NB_ITS
;it
++) {
40 for(i
=0;i
<TAB_SIZE
;i
++) {
53 fprintf(stderr
, "%s start\n", __FUNCTION__
);
55 tab4
= malloc(20 * sizeof(int));
61 fprintf(stderr
, "%s end\n", __FUNCTION__
);
71 fprintf(stderr
, "%s start\n", __FUNCTION__
);
73 tab4
= malloc(20 * sizeof(int));
79 fprintf(stderr
, "%s end\n", __FUNCTION__
);
84 /* XXX: currently: bug */
90 tab4
= malloc(20 * sizeof(int));
105 for(i
=0;i
<TAB_SIZE
+ 1;i
++) {
108 printf("i=%d %x\n", i
, p
);
145 memcpy(tab
, tab1
, 10);
146 memmove(tab
, tab1
, 10);
175 memset(tab
, 'a', sizeof(tab
));
181 char *p
= alloca(TAB_SIZE
);
182 memset(p
, 'a', TAB_SIZE
);
190 char *p
= alloca(TAB_SIZE
-1);
191 memset(p
, 'a', TAB_SIZE
);
199 char *demo
= "This is only a test.";
202 fprintf(stderr
, "%s start\n", __FUNCTION__
);
205 strcpy(p
,"12345678901234");
206 printf("alloca: p is %s\n", p
);
208 /* Test alloca embedded in a larger expression */
209 printf("alloca: %s\n", strcpy(alloca(strlen(demo
)+1),demo
) );
211 fprintf(stderr
, "%s end\n", __FUNCTION__
);
217 char *demo
= "This is only a test.";
220 fprintf(stderr
, "%s start\n", __FUNCTION__
);
223 strcpy(p
,"12345678901234");
224 printf("alloca: p is %s\n", p
);
226 /* Test alloca embedded in a larger expression */
227 printf("alloca: %s\n", strcpy(alloca(strlen(demo
)),demo
) );
229 fprintf(stderr
, "%s end\n", __FUNCTION__
);
232 int (*table_test
[])(void) = {
252 int main(int argc
, char **argv
)
256 int index_max
= sizeof(table_test
)/sizeof(table_test
[0]);
260 "test TCC bound checking system\n"
261 "usage: boundtest N\n"
262 " 1 <= N <= %d\n", index_max
);
268 index
= atoi(argv
[1]) - 1;
270 if ((index
< 0) || (index
>= index_max
)) {
271 printf("N is outside of the valid range (%d)\n", index
);
275 /* well, we also use bounds on this ! */
276 ftest
= table_test
[index
];
283 * without bound 0.77 s