shithub: scc

Download patch

ref: a1b605f501ce76d73a9df091c6e5f3e2a3955198
parent: ce2658123d520c647f2c1a3d1a40b3f3d47f73bc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Sep 14 10:57:16 EDT 2016

[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.

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