shithub: scc

Download patch

ref: ed9dc0fc53e6c6073a55941f41b4c4d907547364
parent: 4f26471416516e201f2d0efdfb87f601a5682134
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Sep 16 16:16:12 EDT 2014

Fix offset of auto variables

Typical error 1+.

--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -434,8 +434,8 @@
 localdcl(char *token)
 {
 	Symbol *sym = declaration(LOCAL, token[0], token);
-	sym->u.v.off = -curfun->u.f.locals;
 	curfun->u.f.locals += sym->u.v.type->size;
+	sym->u.v.off = 1-curfun->u.f.locals;
 }
 
 void