commit d5065baafed6ee455fc43471085b899d6cf614a0
Author: Hiltjo Posthuma <[email protected]>
AuthorDate: Sat Jul 18 20:02:05 2015 +0200
Commit: Hiltjo Posthuma <[email protected]>
CommitDate: Sat Jul 18 20:02:05 2015 +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
diff --git a/cc1/symbol.c b/cc1/symbol.c
index c8b3487..f609e13 100644
--- 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);