scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit f20cb974e12e176500a0f44c4ebf3332e26dc463
parent d2dae10b4e8f2bb930d271a335b3ff16df4c6b75
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 17 Aug 2015 10:43:09 +0200

Fix error in popctx()

f was used without any initialization in the label case.

Diffstat:
cc1/symbol.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -109,9 +109,10 @@ popctx(void) localcnt = 0; for (sym = labels; sym; sym = next) { next = sym->next; + f = sym->flags; if ((f & (ISUSED|ISDECLARED)) == ISDECLARED) warn("'%s' defined but not used", sym->name); - if ((sym->flags & ISDECLARED) == 0) + if ((f & ISDECLARED) == 0) printerr("label '%s' is not defined", sym->name); free(sym->name); free(sym); @@ -121,16 +122,16 @@ popctx(void) for (sym = head; sym && sym->ctx > curctx; sym = next) { next = sym->next; + f = sym->flags; if (sym->ns == NS_TAG) sym->type->defined = 0; if (sym->name) { - f = sym->flags; unlinkhash(sym); if ((f & (ISUSED|ISGLOBAL|ISDECLARED)) == ISDECLARED) warn("'%s' defined but not used", sym->name); } free(sym->name); - if (sym->flags & ISSTRING) + if (f & ISSTRING) free(sym->u.s); free(sym); }