[Mono-bugs] [Bug 54467][Wis] Changed - Incorrect values when subtracting doubles
Tue, 18 May 2004 10:20:11 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by firstname.lastname@example.org.
--- shadow/54467 2004-05-13 09:09:24.000000000 -0400
+++ shadow/54467.tmp.24638 2004-05-18 10:20:11.000000000 -0400
@@ -47,6 +47,32 @@
------- Additional Comments From email@example.com 2004-02-17 17:46 -------
Created an attachment (id=6716)
another test case
+------- Additional Comments From firstname.lastname@example.org 2004-05-18 10:20 -------
+OK, I think I got it.
+The problem is that fp registers are 80 bits long, and doubles are
+just 64 bits long. After d1 is evaluated, it is stored in memory as
+In the evaluation of the expression in the second line, the temporary
+result that is evaluated (that should be equal to d1) is left in the
+fp stack, and the fsubl instruction is executed from there (one
+argument on the fp stack, 80 bits long, the other in memory, 64 bits
+The result of fsubl is not zero.
+This can easily be verified also with a C program (the C compiler
+does the same "mistake" of the mono jit, at least gcc 3.2 does so).
+The MS jit does not do this mistake, at the cost of an extra fstp
+immediately followed by an fld exactly at the same address.
+These two aparently redundant instructions have the effect of making
+the value a proper double (64 bits), so that the result of the fsub
+is actually zero.
+I'll investigate a fix for this...