-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Importer's spilling logic for stfld
is not correct
#71638
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsReproduction (requires using InlineIL;
using System;
using System.Runtime.CompilerServices;
int b = 0;
Console.WriteLine(Problem(10, ref b));
[MethodImpl(MethodImplOptions.NoInlining)]
static int Problem(int a, ref int b)
{
IL.Emit.Ldarga(0);
IL.Emit.Starg(1);
IL.Emit.Ldarg(0);
IL.Emit.Ldarg(1);
IL.Emit.Ldc_I4(0);
IL.Emit.Stfld(new FieldRef(typeof(StructWithIndex), "Index"));
return IL.Return<int>();
}
struct StructWithIndex
{
public int Index;
} Compile and run. Expected result: program prints Actual result: program prints Cause: the importer sometimes only spills "value classes" ( runtime/src/coreclr/jit/importer.cpp Lines 16277 to 16302 in a583698
|
Reproduction (requires
InlineIL.Fody
):Compile and run.
Expected result: program prints
10
.Actual result: program prints
0
.Cause: the importer sometimes only spills "value classes" (
TYP_STRUCT
-containing trees) here:runtime/src/coreclr/jit/importer.cpp
Lines 16277 to 16302 in a583698
The text was updated successfully, but these errors were encountered: