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 tab4
= malloc(20 * sizeof(int));
68 tab4
= malloc(20 * sizeof(int));
83 tab4
= malloc(20 * sizeof(int));
98 for(i
=0;i
<TAB_SIZE
+ 1;i
++) {
101 printf("i=%d %x\n", i
, p
);
138 memcpy(tab
, tab1
, 10);
139 memmove(tab
, tab1
, 10);
168 memset(tab
, 'a', sizeof(tab
));
172 #if defined __i386__ || defined __x86_64__
176 #define alloca(x) malloc(x)
177 #define allocf(x) free(x)
182 char *p
= alloca(TAB_SIZE
);
184 memset(p
, 'a', TAB_SIZE
);
194 char *p
= alloca(TAB_SIZE
-1);
196 memset(p
, 'a', TAB_SIZE
);
206 char *demo
= "This is only a test.";
210 strcpy(p
,"12345678901234");
212 /* Test alloca embedded in a larger expression */
213 printf("alloca : %s : %s\n", p
, strcpy(alloca(strlen(demo
)+1),demo
) );
222 char *demo
= "This is only a test.";
226 strcpy(p
,"12345678901234");
228 /* Test alloca embedded in a larger expression */
229 printf("alloca : %s : %s\n", p
, strcpy(alloca(strlen(demo
)),demo
) );
237 int i
, sum
= 0, n
= TAB_SIZE
;
239 for(i
=0;i
<TAB_SIZE
+1;i
++) {
245 int (*table_test
[])(void) = {
266 int main(int argc
, char **argv
)
272 int index_max
= sizeof(table_test
)/sizeof(table_test
[0]);
274 /* check bounds checking main arg */
275 for (i
= 0; i
< argc
; i
++) {
284 "test TCC bound checking system\n"
285 "usage: boundtest N\n"
286 " 1 <= N <= %d\n", index_max
);
292 index
= atoi(argv
[1]) - 1;
294 if ((index
< 0) || (index
>= index_max
)) {
295 printf("N is outside of the valid range (%d)\n", index
);
299 /* well, we also use bounds on this ! */
300 ftest
= table_test
[index
];
307 * without bound 0.77 s