A x86_64-tcc compiler compiled by i386-tcc is wrong.
./configure --enable-cross --cc=x86_64-tcc
make; make install; x86_64-tcc 009-test.c; a.out
0x6006c0 0x6006bc
./configure --enable-cross --cc=i386-tcc
make; make install; x86_64-tcc 009-test.c; a.out
0x6006c0 0x1006006bc
PS: 009-test.c is the test program described above
/* Tickle a bug in TinyC on 64-bit systems:
* the LSB of the top word or ARGP gets set
* for no obvious reason.
*
* Source: a legacy language interpreter which
* has a little stack / stack pointer for arguments.
*
* Output is: 0x8049620 0x10804961c
* Should be: 0x8049620 0x804961c
*/
#include <stdio.h>
#define NARGS 20000
int ARG[NARGS];
int *ARGSPACE = ARG;
int *ARGP = ARG - 1;
main()
{
printf("%p %p\n", ARGSPACE, ARGP);
}
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel