[Mono-bugs] [Bug 63202][Maj] New - Indexer + Increment results in invalid opcode or compiler crash

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 17 Aug 2004 04:54:08 -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 juraj@hotfeet.ch.

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

--- shadow/63202	2004-08-17 04:54:08.000000000 -0400
+++ shadow/63202.tmp.31371	2004-08-17 04:54:08.000000000 -0400
@@ -0,0 +1,71 @@
+Bug#: 63202
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: juraj@hotfeet.ch               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Indexer + Increment results in invalid opcode or compiler crash
+
+The following two code snippets don't compile correctly:
+
+(i)  ArrayList al = new ArrayList();
+     al[0] = 0;		
+     Console.WriteLine((al[0])++);
+
+Result csc
+----------
+error CS0187: No such operator '++' defined for type 'object'
+
+Result mcs
+----------
+compiles code _without_ error or warning
+
+running the code results in:
+** ERROR **: Invalid IL code at IL001c in Test:Main (string[]): IL_001c:
+add                                                                       
+         
+
+aborting...
+Aborted
+
+
+(ii) ArrayList al = new ArrayList();
+     al[0] = 0;		
+     Console.WriteLine(((int)al[0])++);
+
+Result csc
+----------
+error CS0131: left-hand side of an assignment must be an variable, property
+or indexer
+
+Result mcs
+----------
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: inctest.cs: (5)
+                     Block being compiled: [inctest.cs: (5),inctest.cs: (10)]
+System.InvalidCastException: Cannot cast from source type to destination type.
+        in UnaryMutator.ResolveOperator (Mono.CSharp.EmitContext)
+        in UnaryMutator.DoResolve (Mono.CSharp.EmitContext)
+        in Expression.Resolve (Mono.CSharp.EmitContext,
+Mono.CSharp.ResolveFlags )
+        in Expression.Resolve (Mono.CSharp.EmitContext)
+        in Argument.Resolve (Mono.CSharp.EmitContext, Mono.CSharp.Location)
+        in Invocation.DoResolve (Mono.CSharp.EmitContext)
+        in Expression.Resolve (Mono.CSharp.EmitContext,
+Mono.CSharp.ResolveFlags )
+        in Expression.Resolve (Mono.CSharp.EmitContext)
+        in ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext)
+        in StatementExpression.Resolve (Mono.CSharp.EmitContext)
+        in Block.Resolve (Mono.CSharp.EmitContext)
+        in EmitContext.EmitTopBlock (Mono.CSharp.Block,
+Mono.CSharp.InternalPara meters, Mono.CSharp.Location)