[Mono-bugs] [Bug 52427][Wis] New - invalid IL from do { if (a) break; throw new Exception } while true
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 10 Jan 2004 09:00:39 -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 pcgod@gmx.net.
http://bugzilla.ximian.com/show_bug.cgi?id=52427
--- shadow/52427 2004-01-10 09:00:39.000000000 -0500
+++ shadow/52427.tmp.30125 2004-01-10 09:00:39.000000000 -0500
@@ -0,0 +1,56 @@
+Bug#: 52427
+Product: Mono/Compilers
+Version: unspecified
+OS: unknown
+OS Details:
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Wishlist
+Component: C#
+AssignedTo: martin@ximian.com
+ReportedBy: bmaurer@users.sf.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: invalid IL from do { if (a) break; throw new Exception } while true
+
+using System;
+
+class T {
+ static bool a;
+ static void Main () {
+ do {
+ if (a)
+ break;
+ throw new NotImplementedException ();
+ } while (true);
+ }
+}
+
+Run and you get
+** ERROR **: Invalid IL code at IL000a in .T:Main (): IL_000a: br
+IL_001a
+
+the IL code is:
+
+ IL_0000: ldsfld bool 'T'::'a'
+ IL_0005: brfalse IL_000f
+
+ IL_000a: br IL_001a
+
+ IL_000f: newobj instance void class
+[mscorlib]'System.NotImplementedException'::.ctor()
+ IL_0014: throw
+ IL_0015: br IL_0000
+
+Note the branch goes outside the method.
+
+------- Additional Comments From bmaurer@users.sf.net 2003-12-24 10:07 -------
+Assigning to Martin, on the request of Miguel.
+
+------- Additional Comments From pcgod@gmx.net 2004-01-10 09:00 -------
+Created an attachment (id=6382)
+proposed patch
+