New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid IL code - cgt.un when comparing null with void* #20709
Comments
In IL, |
For equality comparisons, teh right op-code would be |
Yes, but it doesn't have to.
It's an unsigned check, and nothing can be less than 0 there, so the
I assume you mean |
It is || as not equal is the same as less than or greater than. Two numbers can never be less than and greater than at the same time. |
Oh yeah, i am silly |
We recently had the following bug report: dotnet/Silk.NET#389 complaining about an invalid IL code. On further investigation, we saw a very similar situation reported on your Gitter.
Current Behavior
The following is the offending IL (see
IL_002-IL_008
):Which is similar to the Gitter report, in that the
cgt.un
is used for a null check against avoid*
variable:Note: both examples are comparing a
void*
withnull
; as such a minimal repo might be:Expected Behavior
This should not be considered invalid IL as this is valid in Roslyn.
ECMA-355 (pg. 371) states (emphasis added):
Indicating that a
ldnull
should be considered as analogous to the appropriateldc.i4.0
orldc.i8.0
instruction.Further, pg.303 explicitly states:
As such, the issue is most likely due to the first comparand being of type
void*
which is of no type?The text was updated successfully, but these errors were encountered: