[Mono-bugs] [Bug 31470][Nor] New - unnecessary leave after throw

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
30 Sep 2002 07:25:18 -0000


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 dietmar@ximian.com.

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

--- shadow/31470	Mon Sep 30 03:25:18 2002
+++ shadow/31470.tmp.11913	Mon Sep 30 03:25:18 2002
@@ -0,0 +1,79 @@
+Bug#: 31470
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dietmar@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: unnecessary leave after throw
+
+Description of Problem:
+
+When compiled with mcs the following program does not terminate as
+expected. The csc compiled version works.
+
+Steps to reproduce the problem:
+
+------------------
+using System;
+
+class Foo {
+  static void Main() {
+    try {
+      throw new Exception();
+    } catch {
+      throw;
+    }
+  }
+}
+----------------
+
+compile with mcs and run.
+
+
+Actual Results:
+
+endless loop.
+
+Expected Results:
+
+Unhandled Exception: System.Exception: 
+in <0x0002b> 00 .Foo:Main ()
+
+How often does this happen? 
+
+always
+
+Additional Information:
+
+    .method privatestatic 
+           default void Main()  cil managed 
+    {
+        // Method begins at RVA 0x20f4
+	.entrypoint
+	// Code size 19 (0x13)
+	.maxstack 1
+	.try { // 0
+	  IL_0000: newobj instance void class [corlib]System.Exception::.ctor()
+	  IL_0005: throw 
+	  IL_0006: leave IL_0013
+
+	} // end .try 0
+	catch [mscorlib]System.Object { // 0
+	  IL_000b: pop 
+	  IL_000c: rethrow 
+	  IL_000e: leave IL_0013
+
+	} // end handler 0
+    } // end of method default void Main() 
+
+both leave instructions are unnecessary and wrong, because they point to no
+valid IL code.