scc

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

commit 183aa643c31403f78ae47e6cd6e86fc639c33c6b
parent 73173f33f7fe04ab610b0be20afef392eda59fed
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  3 Feb 2017 15:11:48 +0100

[cc2-qbe] Handle left casts in abbreviations

Due to the difference of sizes it is possible to have casts in
the lhs part of an expression, which must be handle out of
lhs(), because it is only due to the double meaning of
abbreviations (being a lhs() and rhs()).

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

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -563,6 +563,15 @@ rhs(Node *np, Node *ret) aux2.right = np->right; aux2.left = np->left; r = rhs(&aux2, &aux1); + Node aux3; + if (l->op == OCAST) { + aux3.type = l->left->type; + aux3.op = OCAST; + aux3.left = r; + aux3.right = NULL; + r = &aux3; + l = l->left; + } case 0: /* TODO: see what is the most difficult */ lhs(l, &aux2);