[Mono-bugs] [Bug 59867][Nor] New - breaking out of a switch within if statement behaves wrongly
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 9 Jun 2004 09:25:36 -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=59867
--- shadow/59867 2004-06-09 09:25:36.000000000 -0400
+++ shadow/59867.tmp.26462 2004-06-09 09:25:36.000000000 -0400
@@ -0,0 +1,87 @@
+Bug#: 59867
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details: Gentoo
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: alan.schmitt@polytechnique.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: breaking out of a switch within if statement behaves wrongly
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Doing a break within a if statement does not seem to behave correctly. The
+following program illustrates this:
+class Test {
+
+ public static void Main (string[] args) {
+ int x_0 = 0;
+ int ll_1 = 0;
+
+ switch (0) {
+ default:{
+ switch (x_0) {
+ case 0:{
+ if (ll_1 == 0) {
+ System.Console.WriteLine("foo");
+ break;
+ } else {
+ System.Console.WriteLine("** Never Appears **");
+ goto k_1;
+ }
+ }
+ default:{
+ System.Console.WriteLine("** Never Appears **");
+ goto k_1;
+ }
+ }
+ System.Console.WriteLine("!!!! THIS SHOULD APPEAR !!!!");
+ break;
+ }
+ k_1:{
+ System.Console.WriteLine("**** THIS SHOULD NOT APPEAR ****");
+ break;
+ }
+ }
+ }
+}
+
+Moreover, a spurious Warning about unreachable code is displayed about line
+24 (the "!!!! THIS SHOULD APPEAR !!!!" line).
+
+Steps to reproduce the problem:
+1. compile the previous program
+2. run it
+3.
+
+Actual Results:
+
+schmitta@charm tmp % mcs simple.cs
+simple.cs(24) warning CS0162: Unreachable code detected
+Compilation succeeded - 1 warning(s)
+schmitta@charm tmp % mono simple.exe
+foo
+**** THIS SHOULD NOT APPEAR ****
+
+Expected Results:
+
+no warning, "!!!! THIS SHOULD APPEAR !!!!" should be displayed, and no
+"**** THIS SHOULD NOT APPEAR ****"
+
+How often does this happen?
+
+All the time.
+
+Additional Information:
+
+I am using the Gentoo ebuild 0.95, which corresponds to the beta 2.