[Mono-bugs] [Bug 74529][Nor] Changed - mcs fails to detect unassigned variable

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 9 Apr 2005 15:16:58 -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 miguel@ximian.com.

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

--- shadow/74529	2005-04-08 15:47:08.000000000 -0400
+++ shadow/74529.tmp.24306	2005-04-09 15:16:58.000000000 -0400
@@ -2,16 +2,16 @@
 Product: Mono: Compilers
 Version: unspecified
 OS: All
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: C#
-AssignedTo: mono-bugs@ximian.com                            
+AssignedTo: martin@ximian.com                            
 ReportedBy: gonzalo@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
 Summary: mcs fails to detect unassigned variable
@@ -37,6 +37,36 @@
 
 Actual results:
 It compiles.
 
 Expected results:
 mono-service.cs(191): error CS0165: Use of unassigned local variable 'service'
+
+------- Additional Comments From miguel@ximian.com  2005-04-09 15:16 -------
+Flow-analysis bug, assignign to Martin.
+
+A self contained sample:
+using System;
+
+public class Foo {
+    static void Main ()
+    {
+        int service;
+        string name = null;
+
+        if (name != null){
+            foreach (char b in "hola"){
+                if (b == 'c'){
+                    service = 1;
+                    break;
+                }
+            }
+        } else {
+            service = 0;
+        }
+
+        Console.WriteLine (service);
+    }
+
+}
+
+