[Mono-bugs] [Bug 79798][Wis] New - possible to generate invalid IL

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Nov 1 01:12:15 EST 2006


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 porges+ximian at porg.es.

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

--- shadow/79798	2006-11-01 01:12:15.000000000 -0500
+++ shadow/79798.tmp.20360	2006-11-01 01:12:15.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 79798
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: porges+ximian at porg.es               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: possible to generate invalid IL
+
+Description of Problem:
+It is possible to produce code which compiles fine although it contains
+errors. These errors cause invalid IL to be generated.
+
+Steps to reproduce the problem:
+I came across this problem when accessing a instance variable from inside a
+foreach loop inside a method declared static.
+
+Actual code;
+private static IEnumerable<Parsed> termOrUnary (string s, int from,
+Stack<Node> nodes, Stack <Operator> ops) {
+	foreach (Parsed termP in defaultTerm.Parse(s, from)) {
+		nodes.Push(termP.Node);
+		yield return termP;
+		nodes.Pop();//needed for later if this ever uses BTing
+	}
+	//FIXME: unary operator not implemented yet
+}
+
+(defaultTerm being the instance variable)
+
+Actual Results:
+
+Successful compile with runtime exception upon execution:
+
+Unhandled Exception: System.InvalidProgramException: Invalid IL code in
+<termOrUnary>__8:.ctor
+(bool,string,int,System.Collections.Generic.Stack`1,System.Collections.Generic.Stack`1):
+IL_001d: stfld     0x04000072
+
+
+  at <0x00000> <unknown method>
+  at Parser.OpTable.termOrUnary (System.String s, Int32 from,
+System.Collections.Generic.Stack`1 nodes,
+System.Collections.Generic.Stack`1 ops) [0x00000] 
+  at Parser.OpTable+<expression>__7.MoveNext () [0x00000] 
+  at Parser.Forwarder+<Parse>__6.MoveNext () [0x00000] 
+  at Parser.Sequence+<RecurseAlong>__0.MoveNext () [0x00000] 
+  at Parser.Parser.StartParse (System.String input) [0x00027] in
+/home/porges/Public/Parser/Parser/Parser.cs:18 
+  at Parser.MainClass.Main (System.String[] args) [0x0019d] in
+/home/porges/Public/Parser/Parser/Main.cs:56 
+
+Expected Results:
+
+An error during compilation.


More information about the mono-bugs mailing list