[Mono-bugs] [Bug 49602][Min] New - Invalid code generated for unreachable code

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 13 Oct 2003 07:31: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 gonzalo@ximian.com.

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

--- shadow/49602	2003-10-13 07:31:08.000000000 -0400
+++ shadow/49602.tmp.1621	2003-10-13 07:31:08.000000000 -0400
@@ -0,0 +1,60 @@
+Bug#: 49602
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Invalid code generated for unreachable code
+
+Compile this:
+class C
+{
+        static int Main ()
+        {
+                int i = 0;
+                return 0;
+                if (i == 0)
+                        return 0;
+        }
+}
+
+and run it.
+
+Actual results:
+** ERROR **: Invalid IL code at IL0006 in .C:Main (): IL_0006: bne.un   
+IL_000d
+
+Expected results:
+nothing
+
+monodis output:
+    .method private static
+           default int32 Main ()  cil managed
+    {
+        // Method begins at RVA 0x20f4
+        .entrypoint
+        // Code size 13 (0xd)
+        .maxstack 3
+        .locals init (
+                int32   V_0)
+        IL_0000:  ldc.i4.0
+        IL_0001:  stloc.0
+        IL_0002:  ldc.i4.0
+        IL_0003:  ret
+        IL_0004:  ldloc.0
+        IL_0005:  ldc.i4.0
+        IL_0006:  bne.un IL_000d
+ 
+        IL_000b:  ldc.i4.0
+        IL_000c:  ret
+    } // end of method C::default int32 Main ()