sq / JSIL

CIL to Javascript Compiler

Home Page:http://jsil.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsigned comparisons work incorrect

iskiselev opened this issue · comments

Looks like JSIL ignore whether comparison should be down with unsigned values. Here is test case:

.assembly Hello {}
.assembly extern mscorlib {}

.class public abstract sealed Program
	extends [mscorlib]System.Object
{
	.method static void Main()
	{
		.entrypoint
		.maxstack 1
		ldc.i4       -1
		ldc.i4.5 
		ble.un.s     TRUE
		ldstr        "Hello, world!"
		call         void [mscorlib]System.Console::WriteLine(string)
		TRUE:
		ret
	}
}

It means if ((uint)-1 >5) Console.WriteLine("HelloWorld") but was translated as:

    if (-1 > 5) {
      $T00().WriteLine("Hello, world!");
    }

Roslyn use such expressions pretty much within async state machines with try/catch statements.