Mercurial > hg > tinycc
changeset 486:c8a874736ed2
If the first line of the file is "long long 1LL<32;" tcc screws up vstack[-1]
because it assumes there's always at least one slot of scratch space it
can use for a temporary vswap() as long as it puts it back later. It's not
safe to do that to memory you don't own, and in this case resulted in
define_stack getting corrupted. Easy fix: give it the scratch space.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 27 Sep 2007 19:29:20 -0500 |
parents | ef9f005aa6eb |
children | 2768f7c24156 |
files | tcc.c |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tcc.c Thu Sep 27 18:49:33 2007 -0500 +++ b/tcc.c Thu Sep 27 19:29:20 2007 -0500 @@ -8441,8 +8441,7 @@ s1->ifdef_stack_ptr = s1->ifdef_stack; file->ifdef_stack_ptr = s1->ifdef_stack_ptr; - /* XXX: not ANSI compliant: bound checking says error */ - vtop = vstack - 1; + vtop = vstack; s1->pack_stack[0] = 0; s1->pack_stack_ptr = s1->pack_stack; }