Merge "Fix for mysterious x86 division crash." into idea133
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 2543eb7..d980a05 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -3420,9 +3420,14 @@
static inline CPU86_LDouble helper_fdiv(CPU86_LDouble a, CPU86_LDouble b)
{
- if (b == 0.0)
+ // NOTE: work-around to prevent a mysterious crash
+ // This code will be replaced by better one in a future patch.
+ if (float64_is_zero(b)) {
fpu_set_exception(FPUS_ZE);
- return a / b;
+ return float64_div(a, b, &env->fp_status);
+ } else {
+ return a / b;
+ }
}
static void fpu_raise_exception(void)