[Mono-bugs] [Bug 72857][Wis] New - Dead code detection causes compile errors later on
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 22 Feb 2005 11:39:39 -0500 (EST)
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 m_kretzschmar@gmx.net.
http://bugzilla.ximian.com/show_bug.cgi?id=72857
--- shadow/72857 2005-02-22 11:39:39.000000000 -0500
+++ shadow/72857.tmp.17575 2005-02-22 11:39:39.000000000 -0500
@@ -0,0 +1,47 @@
+Bug#: 72857
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: m_kretzschmar@gmx.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Dead code detection causes compile errors later on
+
+public class Foo
+{
+ public static void Main()
+ {
+ if (false)
+ {
+ int pos = -1;
+ for (int i = 0; i < 8; ++i)
+ if (i == 4)
+ {
+ pos = i;
+ break;
+ }
+ System.Console.Write(pos);
+ }
+ }
+}
+
+$ mcs foo.cs
+foo.cs(6) warning CS0162: Unreachable code detected
+foo.cs(8) error CS0165: Use of unassigned local variable `i'
+foo.cs(9) error CS0165: Use of unassigned local variable `i'
+foo.cs(14) error CS0165: Use of unassigned local variable `pos'
+Compilation failed: 3 error(s), 1 warnings
+
+This is with the daily snapshot of 2005-02-21
+
+If you comment out the if (false), it compiles just fine. Of course, this
+is a pathological case, hence the low priority.