[Mono-bugs] [Bug 45807][Maj] New - Invalid assignment causes compiler to crash.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 3 Jul 2003 15:16:59 -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 ettore@ximian.com.

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

--- shadow/45807	Thu Jul  3 15:16:59 2003
+++ shadow/45807.tmp.9059	Thu Jul  3 15:16:59 2003
@@ -0,0 +1,66 @@
+Bug#: 45807
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ettore@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Invalid assignment causes compiler to crash.
+
+The following code makes the compiler die with an exception:
+
+class Foo {
+	struct myStruct {
+		bool foo;
+	}
+
+	private void breakMe ()
+	{
+		myStruct = new myStruct ();
+	}
+}
+
+When compiled with MCS, I get:
+
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: test.cs: (6)
+                     Block being compiled: [test.cs: (7),test.cs: (9)]
+
+Unhandled Exception: System.InvalidCastException: Cannot cast from source
+type to destination type
+in <0x0009c> 00 Mono.CSharp.New:DoEmit (Mono.CSharp.EmitContext,bool)
+in <0x00019> 00 Mono.CSharp.New:EmitStatement (Mono.CSharp.EmitContext)
+in <0x00080> 00 Mono.CSharp.StatementExpression:DoEmit
+(Mono.CSharp.EmitContext)
+in <0x0002b> 00 Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext)
+in <0x00090> 00 Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext)
+in <0x00273> 00 Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext)
+in <0x00184> 00 Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x002c6> 00 Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x00599> 00 Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Block,object)
+in <0x00038> 00 Mono.CSharp.Method:Emit (Mono.CSharp.TypeContainer)
+in <0x0027b> 00 Mono.CSharp.TypeContainer:Emit ()
+in <0x004d8> 00 Mono.CSharp.RootContext:EmitCode ()
+in <0x0084b> 00 Mono.CSharp.Driver:MainDriver (string[])
+in <0x00011> 00 Mono.CSharp.Driver:Main (string[])
+
+I this only happens with structs, but not with classes.  If I replace
+"struct" with "class" I get what I expected, i.e.:
+
+test.cs(8) error CS0131: Left hand of an assignment must be a variable, a
+property or an indexer
+
+$ mcs --version
+Mono C# compiler version 0.24.0.0