[Mono-bugs] [Bug 47822][Nor] New - Wrong IL code for unboxing struct from interface type
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 22 Aug 2003 10:01:43 -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 sestoft@dina.kvl.dk.
http://bugzilla.ximian.com/show_bug.cgi?id=47822
--- shadow/47822 2003-08-22 10:01:43.000000000 -0400
+++ shadow/47822.tmp.16401 2003-08-22 10:01:43.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 47822
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sestoft@dina.kvl.dk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Wrong IL code for unboxing struct from interface type
+
+Description of Problem:
+
+The C# compiler mcs 0.26 generates wrong bytecode for unboxing a struct
+from an interface type (I guess; the runtime correctly executes IL
+generated for this program by MS csc 1.2 alpha).
+
+Steps to reproduce the problem:
+1. Compile program below
+2. Run it; result should be 11, but is not
+
+using System;
+
+class MyTest {
+ public static void Main(String[] args) {
+ S s1 = new S(11);
+ I s2 = s1; // Implicit boxing S-->I
+ S s3 = (S)s2; // Explicit unboxing I-->S
+ s3.Print(); // Should print 11, does not
+ }
+}
+
+interface I {
+ void Print();
+}
+
+struct S : I {
+ public int i;
+ public S(int i) {
+ this.i = i;
+ }
+ public void Print() {
+ Console.WriteLine(i);
+ }
+}
+
+
+Actual Results:
+
+134729068
+
+Expected Results:
+
+11
+
+How often does this happen?
+
+Always with mono 0.26
+
+Additional Information: