tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Predefined macro identifying TinyC?


From: Sergey Korshunoff
Subject: Re: [Tinycc-devel] Predefined macro identifying TinyC?
Date: Fri, 20 Mar 2015 16:38:22 +0300

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);
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]