[Mono-bugs] [Bug 78314][Maj] New - Register allocation bug when
compiling shift-left operator in very simple loop
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sat May 6 11:26:14 EDT 2006
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 bbjamey at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=78314
--- shadow/78314 2006-05-06 11:26:14.000000000 -0400
+++ shadow/78314.tmp.32413 2006-05-06 11:26:14.000000000 -0400
@@ -0,0 +1,121 @@
+Bug#: 78314
+Product: Mono: Runtime
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: JIT
+AssignedTo: lupus at ximian.com
+ReportedBy: bbjamey at gmail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Register allocation bug when compiling shift-left operator in very simple loop
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. Take the IL code
+
+
+.class public auto ansi beforefieldinit Foo
+ extends [mscorlib]System.Object
+{
+ .method public static void _main() cil managed
+ {
+ .entrypoint
+ // Code size 68 (0x44)
+ .maxstack 6
+ .locals init (int32 V_0)
+ IL_0000: ldc.i4.0
+ IL_0001: stloc.0
+ IL_0002: br.s IL_003b
+
+ IL_0004: ldstr "j = {0}"
+ IL_0009: ldloc.0
+ IL_000a: box [mscorlib]System.Int32
+ IL_0014: call void [mscorlib]System.Console::WriteLine(string,
+ object)
+ IL_0019: ldstr "res = {0}"
+ IL_001e: ldc.i4.s 10
+ IL_0020: ldloc.0
+ IL_0021: shl
+ IL_0022: ldc.i4.s 10
+ IL_0024: ldloc.0
+ IL_0025: shl
+ IL_0026: ceq
+ IL_0028: box [mscorlib]System.Boolean
+ IL_0032: call void [mscorlib]System.Console::WriteLine(string,
+ object)
+ IL_0037: ldloc.0
+ IL_0038: ldc.i4.1
+ IL_0039: add
+ IL_003a: stloc.0
+ IL_003b: ldloc.0
+ IL_003c: ldc.i4.1
+ IL_003d: ldc.i4.7
+ IL_003e: add
+ IL_003f: blt.s IL_0004
+
+ IL_0041: ldnull
+ IL_0042: pop
+ IL_0043: ret
+ } // end of method Foo::_main
+
+2. Compile and run using ILASM of the Mono IL assembler. You will see
+
+j = 0
+res = True
+
+Now run it using .NET 2.0 on Windows. You should see
+
+j = 0
+res = True
+j = 1
+res = True
+j = 2
+res = True
+j = 3
+res = True
+j = 4
+res = True
+j = 5
+res = True
+j = 6
+res = True
+j = 7
+res = True
+
+
+Actual Results:
+
+See above
+
+Expected Results:
+
+See above
+
+How often does this happen?
+
+Always. The Microsoft C# compiler inserts an "ldc.i4 31 and" in the
+instruction sequence, which seems to make the bug go away. However for
+the range of numbers considered above this should not be a problem.
+
+
+Additional Information:
+
+This code came from the following simple loop when using the F#
+compiler. It seems likely to be a fairly catastrophic register
+allocation error when compiling "<<<".
+
+ for j = 0 to 7 do
+ System.Console.WriteLine("j = {0}",j);
+ System.Console.WriteLine("res = {0}",(10 <<< j) = (10 <<< j))
+ done
More information about the mono-bugs
mailing list