shithub: scc

Download patch

ref: d5065baafed6ee455fc43471085b899d6cf614a0
parent: d2294dbc2dca02cfe9575734c4e4884aef74f43f
author: Hiltjo Posthuma <[email protected]>
date: Sat Jul 18 16:02:05 EDT 2015

popctx: fix symbol check, only add to table if sym->name is set

this crashed (same parameter name), reproduce:

printf '#define t(n) 1\n#define t2(n) 2' | ./cc1

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -87,7 +87,7 @@
 			sym->type->defined = 0;
 			break;
 		}
-		if (sym->hash)
+		if (sym->name)
 			htab[hash(sym->name)] = sym->hash;
 		free(sym->name);
 		free(sym);