[Mono-bugs] [Bug 60457][Nor] New - Wrong compilation giving Unreachable Code warning...

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 19 Jun 2004 00:39:12 -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 banil@novell.com.

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

--- shadow/60457	2004-06-19 00:39:12.000000000 -0400
+++ shadow/60457.tmp.4772	2004-06-19 00:39:12.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 60457
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: RH 9.0
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: banil@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Wrong compilation giving Unreachable Code warning...
+
+This is observed in atleast :
+Mono C# compiler version 0.95.0.0 &
+Mono C# compiler version 0.96.0.0
+
+Description of Problem:
+mcs gives a wrong "Unreachable Code" warning, and the "so-called"
+unreachable portion is not executed...
+
+Steps to reproduce the problem:
+Here's the sample test code with line numbers...
+
+1: using System;
+                                                                          
+     2:
+3: class Test
+4: {
+5:         static void Main(string[] args)
+6:         {
+7:                 Console.WriteLine("Start");
+8:                 bool b = false;
+9:                 while (true)
+10:                {
+11:                        if (b)
+12:                                break;
+13:                        else
+14:                                break;
+                                                                          
+     15:                }
+16:                Console.WriteLine("End");
+17:        }
+18:}
+
+
+
+Actual Results:
+On compiling the code
+warning CS0162: Unreachable code detected
+is issued for line 16.
+On execution only "Start" is printed on console.
+
+Expected Results:
+Should compile without a warning and on execution, should print
+
+Start
+End
+on the console
+
+How often does this happen? 
+Always
+
+Additional Information:
+None