scc

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

commit e6f7d19657b0acc6a6cbb87da073a18c44efe883
parent c6ea791b9cac2e0e4486156b8751acd82da179dd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 15 Nov 2014 06:30:28 -0500

Fix minus 1 error in declaration

The queue pointer is always pointing to the last free position, so
we have to decrement it always before of beginngin to create types. This
error was not detected because it was not entering in any case of the
switch.

Diffstat:
Mcc1/decl.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -147,7 +147,7 @@ declarator(Type *tp, int8_t flags) memset(data, 0, sizeof(data)); data[NR_DECLARATORS].op = 255; - for (bp = declarator0(data); bp >= data; --bp) { + for (bp = declarator0(data)-1; bp >= data; --bp) { switch (bp->op) { case PTR: tp = mktype(tp, PTR, NULL);