[Mono-bugs] [Bug 49725][Wis] New - Array of invalid size is created.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 16 Oct 2003 03:26:39 -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 malich_y@mail.ru.

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

--- shadow/49725	2003-10-16 03:26:39.000000000 -0400
+++ shadow/49725.tmp.25143	2003-10-16 03:26:39.000000000 -0400
@@ -0,0 +1,81 @@
+Bug#: 49725
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: Win2k + SP4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: malich_y@mail.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Array of invalid size is created.
+
+Please fill in this template when reporting a bug, unless you know what you 
+are doing.
+Description of Problem:
+
+Array of invalid size is created.
+
+Steps to reproduce the problem:
+1. 
+using System;
+
+namespace monobag
+{
+	
+	class App
+	{
+		static uint ArraySize=1000000;
+		[STAThread]
+		static void Main(string[] args)
+		{
+			uint len=(ArraySize / 100)*8+100;
+			//UInt32[] array=new UInt32[(uint)Math.Floor(Math.Sqrt(len))
++100];	
+			UInt32[] array=new UInt32[((uint)Math.Floor(Math.Sqrt(len)) )
++100];	// the statement results in creating an array of invalid size
+			Console.WriteLine("array.Len:"+array.Length.ToString()); // pri
+			uint len2=(uint)Math.Floor(Math.Sqrt(len))+100;
+			UInt32[] array2=new UInt32[len2];	
+			Console.WriteLine("array2.Len:"+array2.Length.ToString());
+		}
+	}
+}
+
+2. mono-0.28-win32-1.exe
+
+ 
+
+Actual Results:
+Command line1: 
+mono.exe monobag.exe
+Output: 
+array.Len:19311148
+array2.Len:383
+
+Command line2: 
+mono.exe --optimize=all monobag.exe
+Output: 
+array.Len:100
+array2.Len:383
+
+
+Expected Results:
+Under MS .Net Framework Output: 
+array.Len:383
+array2.Len:383
+//UInt32[] array=new UInt32[((uint)Math.Floor(Math.Sqrt(len)) )+100];
+	// the statement results in creating an array of 383 elements!
+
+
+How often does this happen? 
+Always
+
+Additional Information:
+mono-0.28-win32-1.exe under Win2k + SP4