commit db8cf76a3a055a1bc065c842516d7193147ba6e3
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Wed Sep 14 14:57:16 2016 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Wed Sep 14 15:32:23 2016 +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.
diff --git a/cc2/code.c b/cc2/code.c
index 5a1170f..68172b5 100644
--- 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;