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__
175 #define alloca(x) malloc(x)
176 #define allocf(x) free(x)
181 char *p
= alloca(TAB_SIZE
);
183 memset(p
, 'a', TAB_SIZE
);
193 char *p
= alloca(TAB_SIZE
-1);
195 memset(p
, 'a', TAB_SIZE
);
205 char *demo
= "This is only a test.";
209 strcpy(p
,"12345678901234");
212 /* Test alloca embedded in a larger expression */
213 printf("alloca : %s : %s\n", p
, strcpy(alloca(strlen(demo
)+1),demo
) );
221 char *demo
= "This is only a test.";
225 strcpy(p
,"12345678901234");
228 /* Test alloca embedded in a larger expression */
229 printf("alloca : %s : %s\n", p
, strcpy(alloca(strlen(demo
)),demo
) );
236 int i
, sum
= 0, n
= TAB_SIZE
;
238 for(i
=0;i
<TAB_SIZE
+1;i
++) {
244 int (*table_test
[])(void) = {
265 int main(int argc
, char **argv
)
271 int index_max
= sizeof(table_test
)/sizeof(table_test
[0]);
273 /* check bounds checking main arg */
274 for (i
= 0; i
< argc
; i
++) {
283 "test TCC bound checking system\n"
284 "usage: boundtest N\n"
285 " 1 <= N <= %d\n", index_max
);
291 index
= atoi(argv
[1]) - 1;
293 if ((index
< 0) || (index
>= index_max
)) {
294 printf("N is outside of the valid range (%d)\n", index
);
298 /* well, we also use bounds on this ! */
299 ftest
= table_test
[index
];
306 * without bound 0.77 s