-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/7.0] JIT: Fix segfault for modulo computations involving add…
…ress-of expressions (#76171) * Add a test * JIT: Use gtCloneExpr in fgMorphModToSubMulDiv for potentially complex trees We may get here for any invariant dividend/divisor but these can be 'complex' address-of trees that gtClone does not handle. Fix #76051 * Fix test build Co-authored-by: Jakob Botsch Nielsen <jakob.botsch.nielsen@gmail.com>
- Loading branch information
1 parent
0b0c060
commit a2058b5
Showing
3 changed files
with
31 additions
and
2 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
19 changes: 19 additions & 0 deletions
19
src/tests/JIT/Regression/JitBlue/Runtime_76051/Runtime_76051.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,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
public class Runtime_76051 | ||
{ | ||
public static int Main(string[] args) | ||
{ | ||
GetIndex(1); | ||
return 100; | ||
} | ||
|
||
// This tests an assertion failure (debug)/segfault (release) in | ||
// fgMorphModToSubMulDiv due to the use of gtClone that fails for the | ||
// complex tree seen for the address-of expression. | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static unsafe int GetIndex(uint cellCount) => (int)((ulong)&cellCount % cellCount); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/tests/JIT/Regression/JitBlue/Runtime_76051/Runtime_76051.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,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<Optimize>True</Optimize> | ||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |