[Mono-bugs] [Bug 56439][Nor] New - CS0165 due to wrong flow analysis

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 3 Apr 2004 17:47:05 -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 kronos@people.it.

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

--- shadow/56439	2004-04-03 17:47:05.000000000 -0500
+++ shadow/56439.tmp.19191	2004-04-03 17:47:05.000000000 -0500
@@ -0,0 +1,63 @@
+Bug#: 56439
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: kronos@people.it               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0165 due to wrong flow analysis
+
+Description of Problem:
+
+If a variable is initialized with a function in unreachable code and then
+the same var is used in unreachable code mcs complain about the use of an
+unitiliazed variable. This may often happens during development stage when
+lots of debugging code is added/removed.
+
+
+Steps to reproduce the problem:
+
+This small program shows the bug:
+
+public class Test {
+	public static int Quux(int x) {
+		return x + 123;
+	}
+	public static void Main() {
+		return;
+
+		int foo;
+		int bar;
+		int x = 456;
+		
+		foo = Quux(x); /* line 12 */
+		bar = foo; /* line 13 */
+	}
+}
+
+Actual Results:
+
+/tmp/test.cs(12) warning CS0162: Unreachable code detected
+/tmp/test.cs(13) error CS0165: Use of unassigned local variable `foo'
+Compilation failed: 1 error(s), 1 warnings
+
+
+Expected Results:
+
+mcs detects dead code correctly so it shouldn't track variable initialization.
+
+How often does this happen?
+
+Always.
+
+
+Additional Information: