commit 183aa643c31403f78ae47e6cd6e86fc639c33c6b
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Feb 3 15:11:48 2017 +0100
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Fri Feb 3 15:11:48 2017 +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()).

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 50a7b3f..9682039 100644
--- 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);

Reply via email to