scc

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

commit ee4761d6223d09d9fe13af32f3ba31722bbb44c1
parent cae77758d639ac4ec3883dfebfc48641adf3d358
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  1 Mar 2017 17:06:03 +0100

[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.

Diffstat:
cc1/symbol.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -27,9 +27,19 @@ void 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));