shithub: scc

Download patch

ref: cde05e319be1e511ff3dd66a15ba048e09876de3
parent: 52efd1500ebcdd1b19b7ec791a5d1e427b655ab7
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Mar 16 06:28:58 EDT 2015

Fix automatic addressing

SP always point to the last correct value, so, IX points
to the previous value of IX in the stack. It means that all
the address in  the stack must be passed this last value.

--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -511,7 +511,7 @@
 
 	if (sclass == 'A' || sclass == 'R') {
 		curfun->u.f.locals += sym->u.v.type.size;
-		sym->u.v.off = 1-curfun->u.f.locals;
+		sym->u.v.off = curfun->u.f.locals;
 	}
 }