shithub: scc

Download patch

ref: 66ec3ad2b63d6640dd6a16dc57ec3178a33c645c
parent: 83bd84e42a0dd0d049e1c8a8dbb7ee52cdfa0b9d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Aug 18 08:57:49 EDT 2016

[cc2-qbe] Fix OAND case in bool()

When bool() calls itself recursively in OAND we have to maintain
the label for the false case, but the code was changing it to the
label for the true case, generating an inversion in the left part
of the OAND expression.

--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -321,7 +321,7 @@
 		break;
 	case OAND:
 		label = newlabel();
-		bool(l, label, true);
+		bool(l, label, false);
 		setlabel(label);
 		bool(r, true, false);
 		break;