Bugzilla – Bug 313885
FIX: generated inverted floating point comparisons are not correct
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by vargaz@freemail.hu 2004-02-12 16:07:38 MST ---- Using the following testcase: double a = Double.NaN; if (a == a) Console.WriteLine (); if (a < a) Console.WriteLine (); if (a > a) Console.WriteLine (); } here, mcs generates the following branches: bne.un bge ble csc generates the following (correct) branches: bne.un bge.un ble.un since the negation of 'lesser' is 'greater-or-equal-or-unordered' ---- Additional Comments From bmaurer@users.sf.net 2004-02-14 14:32:57 MST ---- Created an attachment (id=165612) patch ---- Additional Comments From bmaurer@users.sf.net 2004-02-14 14:33:39 MST ---- Ok, we just forgot to copy the code for this case into two other statements. ---- Additional Comments From bmaurer@users.sf.net 2004-02-15 00:37:35 MST ---- for the record, regression tests pass with this. Before I check this in, however, I want to generate a test suite for all the compare possibilities. We should just have a program generate code like: double a, b; // vary these if (!(a < b ? expected_true : !expected_true)) Fail ("a < b"); (the redundant code is ot make sure we use branchable). ---- Additional Comments From bmaurer@users.sf.net 2004-02-16 00:14:23 MST ---- Note to self: Miguel said that once the tests are generated, this is OK to check in. ---- Additional Comments From miguel@ximian.com 2004-02-27 02:33:04 MST ---- Zoltan, one question: how is it that you tracked this bug. Am wondering how should we write a regression test for this, as I could not track what the difference was supposed to be. ---- Additional Comments From vargaz@freemail.hu 2004-02-27 07:22:55 MST ---- The comparisons must be tested using Nan or infinity, since this is where bne and bne.un differs. I think there is a bug in the runtime too since the test runs fine with the code generated by mcs, but if you run the mcs generated code on the MS runtime, you get different results. ---- Additional Comments From bmaurer@users.sf.net 2004-02-27 07:59:59 MST ---- Ok, so I am moving this over to runtime. Once we have a fix there, we can put a test in the mcs test folder (as well as the mono regression set), and get this thing closed. Thanks for reminding of this, Miguel, it had almost fallen off my radar. Also, a little item for thought: this has the potential to break applications that have been compiled without the fix. Not sure if there is anything we can do here, sadly. ---- Additional Comments From bmaurer@users.sf.net 2004-02-27 08:00:55 MST ---- Ok, this is not assigned to me for the runtime. ---- Additional Comments From vargaz@freemail.hu 2004-03-20 13:32:02 MST ---- This is now fixed in the runtime, so back to mcs. This bug now causes the mcs compiled mini/basic-float.exe tests to fail. ---- Additional Comments From bmaurer@users.sf.net 2004-03-20 15:25:50 MST ---- Fixed in CVS. Imported an attachment (id=165612) Unknown operating system unknown. Setting to default OS "Other".