commit 777c75e345f724aa3a6830fdd340437bab46c65e
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Jun 17 15:18:16 2016 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Fri Jun 17 15:18:16 2016 +0200

    [cc2-qbe] Load parameters before calling functions
    
    We were not loading the parameters, so it mean
    that we were always passing pointers to the
    parameters that were symbols.

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 77a4691..ddc0207 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -239,8 +239,10 @@ call(Node *np)
        Type *tp = &np->type;
        Node **q, *tmp, *p, *pars[NR_FUNPARAM];
 
-       for (n = 0, p = np->right; p; p = p->right)
-               pars[n++] = cgen(p->left);
+       for (n = 0, p = np->right; p; p = p->right) {
+               cgen(p->left);
+               pars[n++] = load(p, LOADL);
+       }
 
        switch (tp->size) {
        case 0:

Reply via email to