[hackers] [scc] [cc2-qbe] Load parameters before calling functions || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 17 Jun 2016 15:20:06 +0200 (CEST)

commit 777c75e345f724aa3a6830fdd340437bab46c65e
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Jun 17 15:18:16 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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:
Received on Fri Jun 17 2016 - 15:20:06 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 17 2016 - 15:24:15 CEST