scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 34e6b11260c579164660ac7fb1e1348000b8cf80
parent 28b4043893d831ce7209dc413e7ce43047de3da0
Author: Roberto E. Vargas Caballero <roberto.vargas@igrid-td.com>
Date:   Mon, 26 Sep 2016 12:29:30 +0200

[cc2-qbe] Fix cast() bug

We always must return the address of a result node, but in this
case we were returning the address without filling the node.

Diffstat:
Mcc2/arch/qbe/cgen.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -160,8 +160,10 @@ cast(Type *td, Node *ns, Node *nd) s_isint = (ts->flags & INTF) != 0; if (d_isint && s_isint) { - if (td->size <= ts->size) + if (td->size <= ts->size) { + *nd = *ns; return nd; + } assert(td->size == 4 || td->size == 8); switch (ts->size) { case 1: