Closed KrisVandermotten closed 7 years ago
Comparisons ignoring signedness is a known issue in the old decompiler engine.
On your code, the newdecompiler branch produces:
public static bool IsGood(Example example)
{
if ((uint)(example - 2) <= 3u)
{
return true;
}
return false;
}
This was fixed in the new decompiler engine (which just landed on the master branch).
Compile the following C# code with Visual Studio 2017 Update 3, optimizations on:
The method
ÌsGood
is compiled to:Notice the (clever) use of bgt.un.s on signed operands.
ILSpy version 2.4.0.1963 decompiles this method to
This is incorrect. It would return true when passed Example.One, whereas the original code would return false.
There are of course many ways to decompile this correctly, one of them being the original source code. But this is a more reasonable one: