scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit a0cfc89f2d6edb0f059c14000adab63913efce29
parent 6f385b9586ba41aa1d8ba52622bd4792c36453f6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  3 Sep 2015 17:53:23 +0200

Fix type in constant and var nodes

The type of these nodes depende of the symbol passed as parameter,
but the code was not updating the type, so it is needed copy the
type from the symbol to the node.

Diffstat:
cc1/code.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/cc1/code.c b/cc1/code.c @@ -411,6 +411,7 @@ varnode(Symbol *sym) Node *np; np = node(OSYM, sym->type, NULL, NULL); + np->type = sym->type; np->lvalue = 1; np->constant = 0; np->symbol = 1; @@ -424,6 +425,7 @@ constnode(Symbol *sym) Node *np; np = node(OSYM, sym->type, NULL, NULL); + np->type = sym->type; np->symbol = 1; np->constant = 1; np->sym = sym;