[Mono-bugs] [Bug 26973][Nor] Changed - In try block, 'return' doesn't return

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
18 Jul 2002 11:06:05 -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 adb@tardis.ed.ac.uk.


--- shadow/26973	Thu Jul 18 04:23:59 2002
+++ shadow/26973.tmp.22303	Thu Jul 18 07:06:05 2002
@@ -71,6 +71,25 @@
 ------- Additional Comments From duncan@ximian.com  2002-07-18 04:23 -------
 Created an attachment (id=2024)
 a diff of the 2 il files
+------- Additional Comments From adb@tardis.ed.ac.uk  2002-07-18 07:06 -------
+I looked into this a little bit (but got stuck because I couldn't
+build corlib under linux).  When Emit() is called for the Try
+statement, it returns "true" to say "all code paths from this
+statement have their own return".  Actually, this isn't accurate
+because it doesn't really emit an IL 'return'.  Instead, it emits a
+'leave' instruction which jumps to the "return" which is expected to
+get stuck on the end of the method.  Unfortunately, that final
+"return" doesn't get emitted because it thinks all code paths have
+already returned.
+I think this bug could've been detected automatically.  Currently,
+ILGenerator does not check to see if a lable is not marked (ie.
+MarkLabel() hasn't been called on it) when it emits a jump to that
+label.  It should do so.
+I'll try to make time to fix this - especially now I can build corlib
+on linux! :-)