[Mono-bugs] [Bug 40903][Blo] Changed - MCS generates invalid code with pointers & longs
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Tue, 8 Apr 2003 18:59:52 -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 bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=40903
--- shadow/40903 Mon Apr 7 17:48:52 2003
+++ shadow/40903.tmp.10666 Tue Apr 8 18:59:52 2003
@@ -2,13 +2,13 @@
Product: Mono/MCS
Version: unspecified
OS: All
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Blocker
Component: Misc
AssignedTo: mono-bugs@ximian.com
ReportedBy: bmaurer@users.sf.net
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
@@ -48,6 +48,51 @@
Expected Results:
Result: 2882382996
How often does this happen?
Always
+
+------- Additional Comments From bmaurer@users.sf.net 2003-04-08 18:59 -------
+Ok, I tracked this down more. This code demonstrates the problem:
+using System;
+namespace TestCase {
+ public unsafe class Test {
+ static void Main(string[] args) {
+ uint[] uArr = {0, 200};
+ uint[] uArr2 = {0, 200};
+
+ fixed (uint* u = uArr, u2 = uArr2) {
+ Console.WriteLine ("Result 1 and 2
+should be equal");
+ Console.WriteLine ("Result 1: {0}",
+DoOp (u));
+ Console.WriteLine ("Result 2: {0}",
+DoOp2 (u2));
+ }
+ }
+
+ private static uint DoOp (uint *u) {
+ return *(++u) += 0xabcdef;
+ }
+
+ private static uint DoOp2 (uint *u) {
+ *(++u) += 0xabcdef;
+ return *u;
+ }
+
+ }
+}
+
+When compiled with mcs, DoOp1 and DoOp2 produce diferent answers. On
+csc, the answers are the same.
+
+The correct result is:
+Result 1 and 2 should be equal
+Result 1: 11259575
+Result 2: 11259575
+
+When compiled with mcs and run with mono the result is:
+Result 1 and 2 should be equal
+Result 1: 11259575
+Result 2: 147373123
+