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__
);
89 tab4
= malloc(20 * sizeof(int));
104 for(i
=0;i
<TAB_SIZE
+ 1;i
++) {
107 printf("i=%d %x\n", i
, p
);
144 memcpy(tab
, tab1
, 10);
145 memmove(tab
, tab1
, 10);
174 memset(tab
, 'a', sizeof(tab
));
180 char *p
= alloca(TAB_SIZE
);
181 memset(p
, 'a', TAB_SIZE
);
189 char *p
= alloca(TAB_SIZE
-1);
190 memset(p
, 'a', TAB_SIZE
);
198 char *demo
= "This is only a test.";
201 fprintf(stderr
, "%s start\n", __FUNCTION__
);
204 strcpy(p
,"12345678901234");
205 printf("alloca: p is %s\n", p
);
207 /* Test alloca embedded in a larger expression */
208 printf("alloca: %s\n", strcpy(alloca(strlen(demo
)+1),demo
) );
210 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__
);
233 int (*table_test
[])(void) = {
253 int main(int argc
, char **argv
)
259 int index_max
= sizeof(table_test
)/sizeof(table_test
[0]);
261 /* check bounds checking main arg */
262 for (i
= 0; i
< argc
; i
++) {
271 "test TCC bound checking system\n"
272 "usage: boundtest N\n"
273 " 1 <= N <= %d\n", index_max
);
279 index
= atoi(argv
[1]) - 1;
281 if ((index
< 0) || (index
>= index_max
)) {
282 printf("N is outside of the valid range (%d)\n", index
);
286 /* well, we also use bounds on this ! */
287 ftest
= table_test
[index
];
294 * without bound 0.77 s