scc

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

commit 98c1fd02beabaf86babe42ac2c7d2efdc8b94755
parent cc4a166a84e9241d3afd0d274041b265d230df6f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 26 Sep 2015 18:44:32 +0200

Check if the symbol is declared in unlinkhash()

Unlinkhash() can be used with no defined symbols,
and in this case it will generate a segmentation
fault.

Diffstat:
Mcc1/symbol.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -58,6 +58,8 @@ unlinkhash(Symbol *sym) { Symbol **h, *p, *prev; + if ((sym->flags & ISDECLARED) == 0) + return; h = &htab[hash(sym->name)]; for (prev = p = *h; p != sym; prev = p, p = p->hash) /* nothing */;