commit 98c1fd02beabaf86babe42ac2c7d2efdc8b94755
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Sat Sep 26 18:44:32 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Sat Sep 26 18:44:32 2015 +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.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 65a00a6..2de75b3 100644
--- 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 */;

Reply via email to