scc

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

commit 3913894ebfafc5ed3139e45c309767909f01e81c
parent 4c1ed4e19f1113c2162387719b4ca88ed92e60af
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  9 May 2016 17:06:11 +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).

Diffstat:
Mcc2/arch/qbe/cgen.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -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))) {