shithub: scc

Download patch

ref: 4ed32812fd0a83d1bd86fb41f5c4531a6c477148
parent: 4cf972513cefeba94d92337eed301e1f140582cf
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Jul 3 11:15:34 EDT 2013

Fix del_ctx function

del_ctx must decrement the context number after deleting the symbols
of the context, because in other case the condition of the loop is not
working fine. We can not delete the symbols in del_ctx because they are
used in the parsing tree, but we must free them in some moment, so
after printing the tree is a good moment.

--- a/decl.c
+++ b/decl.c
@@ -149,6 +149,7 @@
 			struct node *np = compound();
 			prtree(np);
 			putchar('\n');
+			freesyms();
 			return;
 		}
 	} while (accept(','));
--- a/symbol.c
+++ b/symbol.c
@@ -36,7 +36,6 @@
 	register struct symbol *sym, *next;
 	static char *s;
 
-	--curctx;
 	for (sym = head; sym; sym = next) {
 		if (sym->ctx <= curctx)
 			break;
@@ -46,6 +45,7 @@
 		sym->next = headfun;
 		headfun = sym;
 	}
+	--curctx;
 }
 
 void