shithub: scc

Download patch

ref: 73c50951eaf9c8c209984ba12aafe9812934349a
parent: c25c5f047c289b9e5d0d07e73d80244ceb97786e
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Sep 26 08:29:30 EDT 2016

[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.

--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -160,8 +160,10 @@
 	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: