Module Name:    src
Committed By:   isaki
Date:           Tue Mar 26 10:57:13 UTC 2013

Modified Files:
        src/sys/arch/m68k/fpe: fpu_rem.c

Log Message:
Fix a wrong "raw" comparison in step3.2.
It should solve a PR kern/47692.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/m68k/fpe/fpu_rem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_rem.c
diff -u src/sys/arch/m68k/fpe/fpu_rem.c:1.11 src/sys/arch/m68k/fpe/fpu_rem.c:1.12
--- src/sys/arch/m68k/fpe/fpu_rem.c:1.11	Mon Jul 18 14:11:27 2011
+++ src/sys/arch/m68k/fpe/fpu_rem.c	Tue Mar 26 10:57:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_rem.c,v 1.11 2011/07/18 14:11:27 isaki Exp $	*/
+/*	$NetBSD: fpu_rem.c,v 1.12 2013/03/26 10:57:13 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.11 2011/07/18 14:11:27 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.12 2013/03/26 10:57:13 isaki Exp $");
 
 #include <sys/types.h>
 #include <sys/signal.h>
@@ -92,6 +92,7 @@ __fpu_modrem(struct fpemu *fe, int modre
 {
 	static struct fpn X, Y;
 	struct fpn *x, *y, *r;
+	struct fpn r_bkup;
 	u_int signX, signY, signQ;
 	int j, k, l, q;
 	int Last_Subtract;
@@ -130,15 +131,15 @@ __fpu_modrem(struct fpemu *fe, int modre
 		       y->fp_mant[2] != r->fp_mant[2]) {
 
 			/* Step 3.2 */
-			if (y->fp_exp < r->fp_exp ||
-			    y->fp_mant[0] < r->fp_mant[0] ||
-			    y->fp_mant[1] < r->fp_mant[1] ||
-			    y->fp_mant[2] < r->fp_mant[2]) {
-				CPYFPN(&fe->fe_f1, r);
-				CPYFPN(&fe->fe_f2, y);
-				fe->fe_f2.fp_sign = 1;
-				r = fpu_add(fe);
+			CPYFPN(&r_bkup, r);
+			CPYFPN(&fe->fe_f1, r);
+			CPYFPN(&fe->fe_f2, y);
+			fe->fe_f2.fp_sign = 1;
+			r = fpu_add(fe);
+			if (r->fp_sign == 0) {
 				q++;
+			} else {
+				CPYFPN(r, &r_bkup);
 			}
 
 			/* Step 3.3 */

Reply via email to