-
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
fgMorphArgs reorders (non-call) exception-throwing arguments #63905
Comments
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsDescriptionFor each arg, Reproduction StepsThe following program throws using System.Runtime.CompilerServices;
public unsafe class Program
{
public static void Main(string[] args)
{
Foo();
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Foo()
{
C c = null;
int i = 1;
Bar(c.Field, i / 0);
}
private static void Bar(object o, int val)
{
}
private class C
{
public object Field;
}
} Expected behavior
Actual behavior
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationcc @dotnet/jit-contrib
|
Implement a precise scan for arguments that may throw exceptions which collects the exceptions they may throw. When we see two such interfering sets, make sure that the first argument is evaluated to a temp so that they do not get reordered by sort. Fix dotnet#63905
Implement a precise scan for arguments that may throw exceptions which collects the exceptions they may throw. When we see two such interfering sets, make sure that the first argument is evaluated to a temp so that they do not get reordered by the later sort. Fix #63905
Description
For each arg,
fgMorphArgs
looks forGTF_CALL
andGTF_ASG
to figure out if args before that one need to be spilled to temps in anticipation of sorting them. This should takeGTF_EXCEPT
into account as otherwise we can reorder late args that may throw exceptions.Reproduction Steps
The following program throws
DivisionByZeroException
when it should throwNullReferenceException
:Expected behavior
NullReferenceException
Actual behavior
DivisionByZeroException
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
cc @dotnet/jit-contrib
The text was updated successfully, but these errors were encountered: