scc

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

commit 09da26144179fcba493815c2068f7df631cc9b54
parent db5ea284e2d99a5aa3aa5fcb8242eda7c2bd9904
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 22 Apr 2016 14:58:09 +0200

[cc2] Initialize the type of symbol nodes

A node contains a symbol has the same type that the symbol
contained. The code lacked this initialization, and this
was the reason it was creating nodes without type.

Diffstat:
Mcc2/parser.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cc2/parser.c b/cc2/parser.c @@ -181,10 +181,13 @@ static void symbol(char *token, union tokenop u) { Node *np; + Symbol *sym; sclass = u.op >> 8; np = newnode(); - np->u.sym = getsym(atoi(token+1)); + sym = getsym(atoi(token+1)); + np->u.sym = sym; + np->type = sym->type; np->op = u.op & 0xFF; push(np); }