ref: 915befc8a258da8337f7329437fe819d5ce18a22
parent: 89c576b05ec3efa7bfe0880be3002742fba88cd1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Apr 22 10:58:09 EDT 2016
[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.
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -181,10 +181,13 @@
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);
}