forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SetIndirExceptionFlags should not set `GTF_IND_NONFAULTING` flag if the address has `GTF_EXCEPT` flag. The failing scenario was: We were setting `GTF_IND_NONFAULTING` on this indirection (since `ADDR` Node can't be null) ``` [000003] *--XG------- * IND int [000002] ---XG------- \--* ADDR byref Zero Fseq[i] [000001] ---XG------- \--* FIELD struct s [000000] ------------ \--* LCL_VAR ref V00 arg0 ``` this was then transformed to ``` [000003] *---G------- * IND int [000013] -----+------ \--* ADD byref [000000] -----+------ +--* LCL_VAR ref V00 arg0 [000012] -----+------ \--* CNS_INT long 8 field offset Fseq[s, i] ``` The `GTF_EXCEPT` flag was cleared on `IND` because it had `GTF_IND_NONFAULTING`set and the address no longer had `GTF_EXCEPT` flag. Fixes dotnet/coreclr#27027. Commit migrated from dotnet/coreclr@f58ce06
- Loading branch information
1 parent
e6c64c6
commit 45ca544
Showing
5 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_27027/GitHub_27027.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
public struct S | ||
{ | ||
public int i; | ||
public int j; | ||
} | ||
|
||
public class Test | ||
{ | ||
public S s; | ||
|
||
public static int Main() | ||
{ | ||
// Test that the correct exception is thrown from Run. | ||
// The bug was that the exceptions were reordered and DivideByZeroException | ||
// was thrown instead of NullReferenceException. | ||
try { | ||
Run(null, 0); | ||
} | ||
catch (System.NullReferenceException) | ||
{ | ||
return 100; | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
public static int Run(Test test, int j) | ||
{ | ||
int k = test.s.i + 1/j; | ||
return k; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_27027/GitHub_27027.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<CLRTestPriority>1</CLRTestPriority> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType /> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |