shithub: scc

Download patch

ref: f20cb974e12e176500a0f44c4ebf3332e26dc463
parent: d2dae10b4e8f2bb930d271a335b3ff16df4c6b75
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Aug 17 06:43:09 EDT 2015

Fix error in popctx()

f was used without any initialization in the label case.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -109,9 +109,10 @@
 		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 @@
 
 	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);
 	}