-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
JIT: Assertion failed '!"Bad CastToType() in gtFoldExprConst() for a cast from long" #90798
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue Details// Generated by Fuzzlyn v1.6 on 2023-08-18 14:29:26
// Run on X64 Windows
// Seed: 8230539981346104025
// Reduced from 106.2 KiB to 0.3 KiB in 00:00:51
// Hits JIT assert in Release:
// Assertion failed '!"Bad CastToType() in gtFoldExprConst() for a cast from long"' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Morph - Global' (IL size 43; hash 0xade6b36b; FullOpts)
//
// File: C:\dev\dotnet\runtime4\src\coreclr\jit\gentree.cpp Line: 15048
//
using System.Runtime.CompilerServices;
public struct S1
{
public ulong F0;
}
public class Program
{
public static void Main()
{
S1 vr2 = new S1();
bool vr3 = Unsafe.ReadUnaligned<bool>(ref Unsafe.As<ulong, byte>(ref vr2.F0));
System.Console.WriteLine(vr3);
}
}
|
|
Looks like
is the culprit since it woud have to do two casts due to small type? |
@EgorBo It works if you change |
Hmm, we do create |
so Ah, I see it is. |
I don't think we should be creating |
Note that this is not true for |
Should we introduce a test for this? Something like: byte byte2 = 2;
Assert(1 == (Unsafe.ReadUnaligned<byte>(ref byte2) ? 1 : 0)); |
TYP_BOOL servces no purpose but to confuse today. We try to use it in some cases to make assumptions about the value being 0/1, but this logic is not correct in the face of unnormalized booleans. This change remove TYP_BOOL replacing its uses by TYP_UBYTE. This fixes an issue where we forgot to handle TYP_BOOL. Fix #90798
The text was updated successfully, but these errors were encountered: