Bugzilla – Bug 324277
[Flow Analysis] [Confirmed] switch with goto case/default gives wrong IL when condition is literal
Last modified: 2013-11-26 12:11:10 UTC
---- Reported by ujihara@aurora.dti.ne.jp 2007-05-11 14:12:23 MST ---- Description of Problem: 'switch' statement including 'goto case' or 'goto default' statement gives wrong IL when the switch's condition is literal. Steps to reproduce the problem: 1. Compile and execute the following program. public class A { public static void Main(string[] arg) { switch (10) { case 10: System.Console.Out.WriteLine(10); goto default; default: System.Console.Out.WriteLine("default"); break; } } } Actual Results: Unhandled Exception: System.InvalidProgramException: Invalid IL code in A:Main (string[]): IL_000c: br IL_ffffffff Expected Results: 10 default How often does this happen? Always Additional Information: It also happens when we change 'goto default' into 'goto case 10'.
This bug's status has been confirmed on these versions of Mono: 1.2.2: Broken (default SLED 10 sp1) 1.2.5.1: Broken r88511: Broken
Another flow-analysis issue. The problem is that we emit constant block only. The correct fix is to do flow analysis over all blocks and emit constant block and all remaining blocks marked which are used.
Reassigning to Miguel to drive further resolution...
Fixed.