[Mono-bugs] [Bug 37752][Maj] New - incorrect code with a return from unsafe context

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 8 Feb 2003 06:54:13 -0500 (EST)


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@ximian.com.

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

--- shadow/37752	Sat Feb  8 06:54:13 2003
+++ shadow/37752.tmp.25035	Sat Feb  8 06:54:13 2003
@@ -0,0 +1,41 @@
+Bug#: 37752
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: incorrect code with a return from unsafe context
+
+This sample is compile wrong by mcs:
+class T {
+	static int Main () {
+		byte[] b = new byte [4];
+		unsafe {
+			fixed (byte *p = &b [0]){
+				return 0;
+			}
+		}
+	}
+}
+The resulting IL code looks like:
+	IL_000f: ldc.i4.0 
+	IL_0010: ret 
+	IL_0011: ldc.i4.0
+	IL_0012: conv.u 
+	IL_0013: stloc.1 
+    } // end of method default int32 Main() 
+
+So the code runs past the end of the method.
+This pattern is present in corlib and this bug prevents
+bootstrapping with mini (because it verifies the code)
+and it could cause random crashes with mono.