[Mono-devel-list] mcs generates incorrect IL-code using declarations after goto

Friedrich Priewasser priewasser at gmx.at
Wed Jun 30 12:30:07 EDT 2004


The following simple program compiles using mcs but doesn't run, using csc  
this program works with .net and mono.

public class Test{
   public static void Main(){
     goto end;
     int a;
   end:
     System.Console.WriteLine("end");
   }
}

mcs output:
Test.cs(4) warning CS0162: Unreachable code detected
Compilation succeeded - 1 warning(s)


Execution:

Expected result:
end

Actual result:
** ERROR **: Invalid IL code at IL0000 in C:Main (): IL_0000: br         
IL_ffffffff



More information about the Mono-devel-list mailing list