[Mono-bugs] [Bug 54710][Wis] New - mono produces incorrect arithmetic result
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 21 Feb 2004 17:22:50 -0500 (EST)
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 mathpup@mylinuxisp.com.
http://bugzilla.ximian.com/show_bug.cgi?id=54710
--- shadow/54710 2004-02-21 17:22:50.000000000 -0500
+++ shadow/54710.tmp.3735 2004-02-21 17:22:50.000000000 -0500
@@ -0,0 +1,68 @@
+Bug#: 54710
+Product: Mono/Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mathpup@mylinuxisp.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mono produces incorrect arithmetic result
+
+Description of Problem:
+
+With the default optimizations for x86, mono produces the incorrect result
+of "50" for the program below:
+
+using System;
+
+public class A {
+ public static void Main () {
+ A a = new A ();
+ a.Test ();
+ }
+
+ public void Test ()
+ {
+ A a = new A ();
+ // the following is the problematic line
+ _intValue += a.Value + a.Value / 2;
+ Console.WriteLine (_intValue);
+ }
+
+ private int _intValue;
+ public readonly int Value = 100;
+}
+
+However, when mint is used or mono is used with -O=all, the correct number
+"150" is produced. This occurs independent of the C# compiler used (mcs or
+csc)
+
+Steps to reproduce the problem:
+1. mcs test.cs
+2. mono test.cs
+3.
+
+Actual Results:
+
+Prints "50"
+
+
+Expected Results:
+
+Prints "150"
+
+
+How often does this happen?
+
+Always
+
+
+Additional Information: