[Mono-bugs] [Bug 42386][Wis] New - mcs reports use of assigned variable as unassigned

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 5 May 2003 15:59:14 -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 arch.robison@intel.com.


--- shadow/42386	Mon May  5 15:59:14 2003
+++ shadow/42386.tmp.20336	Mon May  5 15:59:14 2003
@@ -0,0 +1,50 @@
+Bug#: 42386
+Product: Mono/MCS
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: arch.robison@intel.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: mcs reports use of assigned variable as unassigned
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+When mcs compiles the example program, it reports that j is used before it 
+is assigned.  But j is assigned before it is used.  mcs appears to be 
+confused by the fact that "i=j" appears textually before the assignment to 
+j", yet flow-wise is after the assignment to j.
+Steps to reproduce the problem:
+1. Save this test to a file ij.cs:
+public class Wrapper {
+    public static void Main() {
+        int j;
+        for( int i=0; i<10; i=j ) 
+            j = i+1;
+    }
+2. Compile ij.cs with "mcs ij.cs"
+Actual Results:
+Incorrect error message
+    ij.cs(4) error CS0165: Use of unassigned local variable `j'
+    Compilation failed: 1 error(s), 0 warnings
+Expected Results:
+    Program should have compiled without complaint.
+How often does this happen? 
+    Every time.
+Additional Information: