[Mono-bugs] [Bug 76957][Nor] New - compiler crash with anonymous methods

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Dec 9 05:35:44 EST 2005


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 lupus at ximian.com.

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

--- shadow/76957	2005-12-09 05:35:44.000000000 -0500
+++ shadow/76957.tmp.16722	2005-12-09 05:35:44.000000000 -0500
@@ -0,0 +1,53 @@
+Bug#: 76957
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: lupus at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: compiler crash with anonymous methods
+
+The following sample makes mcs crash with:
+Unhandled Exception: System.Exception: This should not happen: both Field
+and Local are null
+in <0x001b3> Mono.CSharp.LocalVariableReference:EmitAssign
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean
+leave_copy, Boolean prepare_for_load)
+in <0x0017c> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext ec, Boolean
+is_statement)
+in <0x0000f> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext ec)
+...
+
+using System;
+
+delegate void Do ();
+
+class T {
+        static void doit (int v) {
+                Console.WriteLine (v);
+        }
+        static void Main () {
+                Do[] arr = new Do [5];
+                for (int i = 0; i < 5; ++i) {
+                        arr [i] = delegate {doit (i);};
+                }
+                for (int i = 0; i < 5; ++i) {
+                        arr [i] ();
+                }
+                for (int i = 0; i < 5; ++i) {
+                        arr [i] = delegate {doit (i);};
+                }
+        }
+
+}
+
+The crash disappears when removing the last for loop.


More information about the mono-bugs mailing list