[Mono-bugs] [Bug 31172][Wis] New - Assignment of decimal to element of decimal[] missing ldelema

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
25 Sep 2002 00:20:15 -0000


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 hwang_rob@yahoo.ca.

http://bugzilla.ximian.com/show_bug.cgi?id=31172

--- shadow/31172	Tue Sep 24 20:20:15 2002
+++ shadow/31172.tmp.8074	Tue Sep 24 20:20:15 2002
@@ -0,0 +1,114 @@
+Bug#: 31172
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: hwang_rob@yahoo.ca               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Assignment of decimal to element of decimal[] missing ldelema
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+mcs does not emit an ldelema opcode when assigning a decimal value to an
+element of a 1D decimal array.  As a result, the subsequent stobj does not
+have the correct values on the stack.
+
+Steps to reproduce the problem:
+1. Compile the following test program:
+
+using System;
+
+public class DecimalTest
+{
+    public static void Main()
+    {
+        decimal[] t = new decimal[1];
+        Decimal d = 10m;
+        t[0] = d;
+    }
+}
+
+2. Examine bytecode with monodis DecimalTest.exe
+
+Actual Results:
+
+    // method line 2
+    .method public static 
+           default void Main()  cil managed 
+    {
+        // Method begins at RVA 0x20f4
+        .entrypoint
+        // Code size 28 (0x1c)
+        .maxstack 6
+        .locals init (
+                valuetype [corlib]System.Decimal[]      V_0,
+                valuetype [corlib]System.Decimal        V_1)
+        IL_0000: ldc.i4.1 
+        IL_0001: newarr [mscorlib]System.Decimal
+        IL_0006: stloc.0 
+        IL_0007: ldc.i4.s 0x0a
+        IL_0009: ldc.i4.0 
+        IL_000a: ldc.i4.0 
+        IL_000b: ldc.i4.0 
+        IL_000c: ldc.i4.0 
+        IL_000d: newobj instance void valuetype
+[corlib]System.Decimal::.ctor(int32, int32, int32, bool, unsigned int8)
+        IL_0012: stloc.1 
+        IL_0013: ldloc.0 
+        IL_0014: ldc.i4.0 
+        IL_0015: ldloc.1 
+        IL_0016: stobj [mscorlib]System.Decimal
+        IL_001b: ret 
+    } // end of method default void Main() 
+
+
+Expected Results:
+
+    // method line 2
+    .method public static 
+           default void Main()  cil managed 
+    {
+        // Method begins at RVA 0x20f4
+        .entrypoint
+        // Code size 33 (0x21)
+        .maxstack 6
+        .locals init (
+                valuetype [corlib]System.Decimal[]      V_0,
+                valuetype [corlib]System.Decimal        V_1)
+        IL_0000: ldc.i4.1 
+        IL_0001: newarr [mscorlib]System.Decimal
+        IL_0006: stloc.0 
+        IL_0007: ldc.i4.s 0x0a
+        IL_0009: ldc.i4.0 
+        IL_000a: ldc.i4.0 
+        IL_000b: ldc.i4.0 
+        IL_000c: ldc.i4.0 
+        IL_000d: newobj instance void valuetype
+[corlib]System.Decimal::.ctor(int32, int32, int32, bool, unsigned int8)
+        IL_0012: stloc.1 
+        IL_0013: ldloc.0 
+        IL_0014: ldc.i4.0 
+        IL_0015: ldelema [mscorlib]System.Decimal
+        IL_001a: ldloc.1 
+        IL_001b: stobj [mscorlib]System.Decimal
+        IL_0020: ret 
+    } // end of method default void Main() 
+
+
+
+How often does this happen? 
+Always.
+
+Additional Information:
+One-line patch to expression.cs (1.356) attached.