Martin Guy <[email protected]> writes: <snip> > The reason is to work round what looks like a bug in the 64-bit > pointer handling, which is > fairly easy to workaround: > > /* 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 > */ > > #define NARGS 20000 > int ARG[NARGS]; > int *ARGSPACE = ARG; > int *ARGP = ARG - 1;
As it happens, this is undefined behaviour by the C language standard -- you can't even construct (let alone use) a pointer that points "before" the start of an array. I don't know whether TinyC is using the permission this gives the implementation, but it is technically free to do whatever it likes in this situation. <snip> -- Ben. _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
