shithub: riscv

Download patch

ref: 393dfd1ced89013a4e67aebdd8950ffb3449773a
parent: 294e940f571e72ac9c7656bf55fe740f7f9dc0d2
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Mar 21 15:05:17 EDT 2014

8c, 6c: fix mulgen botch error for handling multiplication by zero constant

--- a/sys/src/cmd/6c/mul.c
+++ b/sys/src/cmd/6c/mul.c
@@ -312,6 +312,11 @@
 	Mparam *p;
 	Node nod, nods;
 
+	if(v == 0){
+		zeroregm(n);
+		return 1;
+	}
+
 	for(i = 0; i < nelem(multab); i++) {
 		p = &multab[i];
 		if(p->value == v)
--- a/sys/src/cmd/8c/mul.c
+++ b/sys/src/cmd/8c/mul.c
@@ -312,6 +312,11 @@
 	Mparam *p;
 	Node nod, nods;
 
+	if(v == 0){
+		zeroregm(n);
+		return 1;
+	}
+
 	for(i = 0; i < nelem(multab); i++) {
 		p = &multab[i];
 		if(p->value == v)