Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Unsigned comparisons work incorrect #1037

Open
iskiselev opened this issue Feb 25, 2017 · 0 comments
Open

Unsigned comparisons work incorrect #1037

iskiselev opened this issue Feb 25, 2017 · 0 comments
Labels

Comments

@iskiselev
Copy link
Member

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.

@kg kg added the Bug label Feb 25, 2017
@iskiselev iskiselev changed the title Unsigned comparison work incorrect Unsigned comparisons work incorrect Feb 25, 2017
iskiselev pushed a commit to iskiselev/JSIL that referenced this issue Feb 25, 2017
iskiselev pushed a commit to iskiselev/JSIL that referenced this issue Feb 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants