[Mono-bugs] [Bug 48393][Nor] New - Control flow analysis through gotos wrongly detect unassigned variables

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 11 Sep 2003 13:29:15 -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 alan.schmitt@polytechnique.org.

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

--- shadow/48393	2003-09-11 13:29:15.000000000 -0400
+++ shadow/48393.tmp.19796	2003-09-11 13:29:15.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 48393
+Product: Mono/MCS
+Version: unspecified
+OS: Mandrake 9.1
+OS Details: Mandrake cooker
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: alan.schmitt@polytechnique.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Control flow analysis through gotos wrongly detect unassigned variables
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The control flow analysis does not seem to detect unassigned variables
+correctly when using goto.
+
+Steps to reproduce the problem:
+1. Enter the following code:
+
+class Test {
+
+  public static void Main () {
+    int x;
+
+L1:
+    switch (0) {
+      case 1:
+        goto Ln;
+      case 0:
+        x = 2;
+        goto L2;
+    }
+
+L2:
+    x = x + 1;
+    System.Console.WriteLine(x);
+
+Ln:
+    return;
+  }
+}
+
+2. Compile it
+
+Actual Results:
+
+schmitta@alan-schm1p:~/tmp> mcs bug.cs 
+bug.cs(17) error CS0165: Use of unassigned local variable `x'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+Compilation succeeds.
+
+How often does this happen? 
+All the time.
+
+Additional Information:
+mcs from mono-0.26-1mdk
+
+The same code compiles (with warnings) using csc and cscc (pnet).