[Mono-bugs] [Bug 31834][Nor] New - incorrect opcodes emitted for assignment to 1d array of enum

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
6 Oct 2002 18:19:59 -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.


--- shadow/31834	Sun Oct  6 14:19:59 2002
+++ shadow/31834.tmp.17738	Sun Oct  6 14:19:59 2002
@@ -0,0 +1,60 @@
+Bug#: 31834
+Product: Mono/MCS
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: hwang_rob@yahoo.ca               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: incorrect opcodes emitted for assignment to 1d array of enum
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When assigning a value to an element of an array of enums, incorrect
+opcodes are emitted leading the mono runtime (both the jit and the
+interpreter) to fail an assertion.
+Steps to reproduce the problem:
+1. Compile the following with mcs
+class A
+        enum MyEnum {a,b,c};
+        public static void Main()
+        {
+                MyEnum[] arr = new MyEnum[2];
+                arr[0] = MyEnum.c;
+        }
+Actual Results:
+If you run with mint or mono, you get assertion errors.
+Using monodis, you can see that the arr[0]=MyEnum.c assignment loads the
+address of arr[0] and then attempts to do a stelem to set the value --
+which is incorrect.
+Expected Results:
+I believe that instead of using a stelem, it should emit the correct stind
+opcode corresponding to the underlying type of the enum.
+How often does this happen? 
+Additional Information:
+See proposed patch to expression.cs.