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__
);
218 char *demo
= "This is only a test.";
221 fprintf(stderr
, "%s start\n", __FUNCTION__
);
224 strcpy(p
,"12345678901234");
225 printf("alloca: p is %s\n", p
);
227 /* Test alloca embedded in a larger expression */
228 printf("alloca: %s\n", strcpy(alloca(strlen(demo
)),demo
) );
230 fprintf(stderr
, "%s end\n", __FUNCTION__
);
234 int (*table_test
[])(void) = {
254 int main(int argc
, char **argv
)
258 int index_max
= sizeof(table_test
)/sizeof(table_test
[0]);
262 "test TCC bound checking system\n"
263 "usage: boundtest N\n"
264 " 1 <= N <= %d\n", index_max
);
270 index
= atoi(argv
[1]) - 1;
272 if ((index
< 0) || (index
>= index_max
)) {
273 printf("N is outside of the valid range (%d)\n", index
);
277 /* well, we also use bounds on this ! */
278 ftest
= table_test
[index
];
285 * without bound 0.77 s