scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit d5065baafed6ee455fc43471085b899d6cf614a0
parent d2294dbc2dca02cfe9575734c4e4884aef74f43f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 18 Jul 2015 20:02:05 +0200

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

Diffstat:
Mcc1/symbol.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

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