[Mono-bugs] [Bug 75878][Maj] New - mcs generates unreachable code error for reachable code

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 22 16:12:29 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 ash at onezero.org.

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

--- shadow/75878	2005-08-22 16:12:29.000000000 -0400
+++ shadow/75878.tmp.19021	2005-08-22 16:12:29.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 75878
+Product: Mono: Compilers
+Version: 1.1
+OS: Windows XP (Cygwin)
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: ash at onezero.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs generates unreachable code error for reachable code
+
+Hi.
+
+mcs reports this:
+
+| mcs --version
+Mono C# compiler version 1.1.8.0
+| mcs t.cs
+t.cs(8) warning CS0162: Unreachable code detected
+Compilation succeeded - 1 warning(s)
+
+But in t.cs, all code is reachable, as can be demonstrated by running the 
+program "t hello" and "t":
+
+using System;
+
+class Hello
+{
+  public Hello()  {  d_n = 0;  }
+
+  public bool Test(int n)
+  {
+    d_n = 0;
+    test(n);
+    if (d_n > 0)  {  goto theend;  }
+    return false;
+theend:
+    return true;
+  }
+
+  ////// private
+
+  int d_n;
+
+  void test(int n)  {  d_n = n;  }
+}
+
+class Test
+{
+  public static void Main(string[] args)
+  {
+    Hello h = new Hello();
+    Console.WriteLine("result = {0}", h.Test(args.Length));
+  }
+}
+
+Maybe the compiler has an error somewhere in its reachability computations 
+where goto statements are not treated properly with respect to data 
+members.
+
+My build setup is for warnings to be treated as errors, so this is a 
+fairly iritating problem for me as I do not want to switch back and forth 
+between "treat warnings as errors" and "don't treat warnings as errors".


More information about the mono-bugs mailing list