changelog shortlog tags files raw bz2 zip gz

changeset: If the first line of the file is "long long 1LL<32;" tcc screws up vstack[-1]

changeset 486: c8a874736ed2
parent 485:ef9f005aa6eb
child 487:2768f7c24156
author: Rob Landley <rob@landley.net>
date: Thu Sep 27 19:29:20 2007 -0500 (4 years ago)
files: tcc.c
description: 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.
       1--- a/tcc.c	Thu Sep 27 18:49:33 2007 -0500
       2+++ b/tcc.c	Thu Sep 27 19:29:20 2007 -0500
       3@@ -8441,8 +8441,7 @@
       4     s1->ifdef_stack_ptr = s1->ifdef_stack;
       5     file->ifdef_stack_ptr = s1->ifdef_stack_ptr;
       6 
       7-    /* XXX: not ANSI compliant: bound checking says error */
       8-    vtop = vstack - 1;
       9+    vtop = vstack;
      10     s1->pack_stack[0] = 0;
      11     s1->pack_stack_ptr = s1->pack_stack;
      12 }