[Mono-bugs] [Bug 56044][Nor] New - mcs crashes with 4+ nulls in jagged array

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 25 Mar 2004 14:24:57 -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 tekhedd@byteheaven.net.


--- shadow/56044	2004-03-25 14:24:57.000000000 -0500
+++ shadow/56044.tmp.9978	2004-03-25 14:24:57.000000000 -0500
@@ -0,0 +1,84 @@
+Bug#: 56044
+Product: Mono: Compilers
+Version: unspecified
+OS Details: Linux grindstone 2.6.1-gentoo #15 Tue Mar 2 18:26:20 EST 2004 i686 Celeron (Coppermine) GenuineIntel GNU/Linux
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tekhedd@byteheaven.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: mcs crashes with 4+ nulls in jagged array
+Please fill in this template when reporting a bug, unless you know what you
+are doing. (OK.)
+Description of Problem:
+mcs crash when initializing a jagged array with 4 or more nulls. I have
+reproduced this with float and int.
+To reproduce the problem, create a class like this:
+class BugTest
+   // This is OK
+   int[][] myArray = 
+   {null, null, null};
+   // This causes crash
+   int[][] myBadArray = 
+   {null, null, null, null};
+Compile it with mcs:
+grindstone:/tmp$ mcs --version
+Mono C# compiler version
+grindstone:/tmp$ mcs bug.cs -target:library
+Unhandled Exception: System.Exception: unrecognized type in MakeByteBlob:
+in <0x00156> Mono.CSharp.ArrayCreation:MakeByteBlob
+in <0x00034> Mono.CSharp.ArrayCreation:EmitStaticInitializers
+in <0x001e2> Mono.CSharp.ArrayCreation:DoEmit (Mono.CSharp.EmitContext,bool)
+in <0x00016> Mono.CSharp.ArrayCreation:Emit (Mono.CSharp.EmitContext)
+in <0x00194> Mono.CSharp.FieldExpr:EmitAssign
+in <0x00253> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext,bool)
+in <0x00016> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext)
+in <0x001e7> Mono.CSharp.TypeContainer:EmitFieldInitializers
+in <0x00380> Mono.CSharp.Constructor:Emit (Mono.CSharp.TypeContainer)
+in <0x00159> Mono.CSharp.TypeContainer:Emit ()
+in <0x005e6> Mono.CSharp.RootContext:EmitCode ()
+in <0x00b3b> Mono.CSharp.Driver:MainDriver (string[])
+in <0x00020> Mono.CSharp.Driver:Main (string[])
+Expected Results:
+Obviously, the expected result is that bug.cs produces an almost, but not
+quite, entirely useless class.
+How often does this happen? 
+Every time.
+Additional Information:
+This is OK:
+int[][] myBadArray = {new int[]{1, 2} , null, null, null};
+But add _another_ null and you're in trouble again:
+int[][] myBadArray = {new int[]{1, 2} , null, null, null, null};
+I have no idea why you'd want to put that many nulls in a jagged array. Not
+my code!