scc

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

commit db8cf76a3a055a1bc065c842516d7193147ba6e3
parent 867d0a47dcf173249f4af7f191ef5e7c38d7f988
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 14 Sep 2016 14:57:16 +0200

[cc2] Initialize left and right pointers in constnode()

The code follows these pointers in a few cases without looking the op,
so it is better to have them initialized.

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

diff --git a/cc2/code.c b/cc2/code.c @@ -74,8 +74,6 @@ label2node(Node *np, Symbol *sym) sym = newlabel(); if (!np) np = newnode(OLABEL); - else - memset(np, 0, sizeof(np)); np->op = OLABEL; np->u.sym = sym; @@ -87,6 +85,8 @@ constnode(Node *np, TUINT n, Type *tp) { if (!np) np = newnode(OCONST); + np->left = NULL; + np->right = NULL; np->type = *tp; np->u.i = n; return np;