[hackers] [scc] [cc2-qbe] Fix error in load() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 9 May 2016 17:20:30 +0200 (CEST)

commit 3913894ebfafc5ed3139e45c309767909f01e81c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon May 9 17:06:11 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon May 9 17:06:11 2016 +0200

    [cc2-qbe] Fix error in load()
    
    oad() can receive indication of loading a NULL child, so we
    have to test that the child is different of NULL (it happens
    mainly in ORET, where the expression is optional).

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index fde694f..4590bc6 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -123,6 +123,8 @@ load(Node *np, int flags)
         Node *child;
 
         child = (flags & LOADL) ? np->left : np->right;
+ if (!child)
+ return NULL;
         tp = &child->type;
 
         if ((flags & FORCE) || !(child->flags & (ISTMP|ISCONS))) {
Received on Mon May 09 2016 - 17:20:30 CEST

This archive was generated by hypermail 2.3.0 : Mon May 09 2016 - 17:24:16 CEST