shithub: scc

Download patch

ref: 563304a2fe0872c22fc8a1066673276d551029c6
parent: 11845819cdd4384de7c96ccc63d97b9e35d6610c
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Mar 1 12:06:03 EST 2017

[cc1] Fix bug in dumpstab()

The size of the tables is different now, so we need a if-else chain
to get the correct size of the table.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -27,9 +27,19 @@
 dumpstab(Symbol **tbl, char *msg)
 {
 	Symbol **bp, *sym;
+	unsigned size;
 
 	fprintf(stderr, "Symbol Table dump at ctx=%u\n%s\n", curctx, msg);
-	for (bp = tbl; bp < &tbl[NR_SYM_HASH]; ++bp) {
+	if (tbl == htab)
+		size = NR_SYM_HASH;
+	else if (tbl == htabcpp)
+		size = NR_CPP_HASH;
+	else if (tbl == htablbl)
+		size = NR_LBL_HASH;
+	else
+		abort();
+
+	for (bp = tbl; bp < &tbl[size]; ++bp) {
 		if (*bp == NULL)
 			continue;
 		fprintf(stderr, "%d", (int) (bp - htab));