[Mono-bugs] [Bug 77235][Min] New - gmcs makes wrong decision on execution control flow

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jan 12 18:10:44 EST 2006


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 alex.gap at mail.ru.

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

--- shadow/77235	2006-01-12 18:10:44.000000000 -0500
+++ shadow/77235.tmp.17154	2006-01-12 18:10:44.000000000 -0500
@@ -0,0 +1,76 @@
+Bug#: 77235
+Product: Mono: Compilers
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: alex.gap at mail.ru               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs makes wrong decision on execution control flow
+
+Description of Problem:
+gmcs compiler makes wrong decision on execution control flow (and microsoft
+csc too, see
+http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=5629a9f3-c35c-4d45-9ad7-90961eae9da4
+).
+
+Sample function:
+string Bug()
+{
+bool flag = true;
+if (flag)
+return "ugly";
+if (!flag)
+return "bug";
+}
+
+Steps to reproduce the problem:
+Try to compile this:
+
+public class Program
+{
+    static int a = 10;
+
+    static string MakeTest()
+    {
+        bool flag = a == 10;
+        if (flag)
+            return "ugly";
+        if (!flag)
+            return "bug";
+    }
+
+    static void Main(string[] args)
+    {
+        string test = MakeTest();
+    }
+}
+
+Actual Results:
+bug.cs(5,19): error CS0161: `Program.MakeTest()': not all code paths return
+a value
+bug.cs(16,9): warning CS0219: The variable `test' is assigned but its value
+is never used
+Compilation failed: 1 error(s), 1 warnings
+
+Expected Results:
+bug.cs(16,9): warning CS0219: The variable `test' is assigned but its value
+is never used
+Compilation succeeded - 1 warning(s)
+
+How often does this happen? 
+Always
+
+Additional Information:
+Please, don't say me that you will fix it after microsoft. I understand,
+that this bug is rare and it applies to every integral variable, not just
+boolean. But boolean case is 99% of such kind of bug. Boolean only fix
+would be very satisfied and appreciated. Thank you.


More information about the mono-bugs mailing list