[Mono-bugs] [Bug 62055][Nor] New - Methods with stackalloc must have initlocals

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 28 Jul 2004 13:16:36 -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 bmaurer@users.sf.net.

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

--- shadow/62055	2004-07-28 13:16:36.000000000 -0400
+++ shadow/62055.tmp.12109	2004-07-28 13:16:36.000000000 -0400
@@ -0,0 +1,36 @@
+Bug#: 62055
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Methods with stackalloc must have initlocals
+
+As an optimizations, methods which are marked unsafe do not have initlocals
+emitted on them.
+
+However, a stackalloc expression will only be 0 inited if the method has
+initlocals. In this test case:
+
+class X {
+	static unsafe void Main ()
+	{
+		int* x = stackalloc int [10];
+		
+		for (int i = 0; i < 10; i ++)
+			System.Console.WriteLine (x [i]);
+		
+	}
+}
+
+we will print random numbers, while csc's will print 0's.