scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 777c75e345f724aa3a6830fdd340437bab46c65e
parent adb3382f152a1c9ce2ffdad8238bdea13961df48
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 17 Jun 2016 15:18:16 +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.

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

diff --git 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: