shithub: scc

Download patch

ref: b84e1437a4a054d68f3b49fc908580939a795247
parent: bb62eb750a4a55634e242500fdb955278723805e
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Sep 27 06:23:33 EDT 2015

Fix nextsym()

Nextsym() is used when a macro with arguments is found without arguments,
and it is needed to look for a definition with less priority. There were
two different errors in nextsym(), because in case of finding the less
priority symbol it was returning the more priority, and in case of not
finding a less priority symbol it was installing a new symbol, but it
should be only allocated.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -281,9 +281,9 @@
 	for (p = sym->hash; p; p = p->hash) {
 		t = p->name;
 		if (c == *t && !strcmp(s, t))
-			return sym;
+			return p;
 	}
-	return linkhash(allocsym(ns, s));
+	return allocsym(ns, s);
 }
 
 Symbol *