[Mono-bugs] [Bug 75317][Nor] New - CS0162 (unreachable code) incorrectly reported for code using goto statement

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 19 09:17:13 EDT 2005


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 gert.driesen at pandora.be.

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

--- shadow/75317	2005-06-19 09:17:13.000000000 -0400
+++ shadow/75317.tmp.6386	2005-06-19 09:17:13.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 75317
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0162 (unreachable code) incorrectly reported for code using goto statement
+
+mcs incorrectly reports CS0162 (Unreachable code detected) for the 
+following code snippet:
+
+using System;
+
+public class FlowControlTest
+{
+  public static void Main ()
+  {
+    DateTime currentDate = DateTime.Now;
+
+    if (currentDate.Year > 2000) {
+      goto check_year;
+    }
+
+    return;
+
+check_year:
+    Console.WriteLine ("check year");
+    return;
+  }
+}
+
+Actual result:
+
+test.cs(6) warning CS0162: Unreachable code detected
+Compilation succeeded - 1 warning(s)
+
+Expected result:
+
+Succesful compilation without warnings
+
+This is the result you get when you use csc.


More information about the mono-bugs mailing list