forked from dotnet/coreclr
-
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.
Fix issue #26417 = Incorrect caching of loop variable
Contributes to issue #7147 - JIT: Loop hoisting re-ordering exceptions Added the Test case for Issue 26417 Updated comments Rebased
- Loading branch information
Showing
3 changed files
with
100 additions
and
8 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
47 changes: 47 additions & 0 deletions
47
tests/src/JIT/Regression/JitBlue/GitHub_26417/GitHub_26417.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,47 @@ | ||
// 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; | ||
|
||
class GitHub_26417 | ||
{ | ||
static int _a; | ||
|
||
[MethodImplAttribute(MethodImplOptions.NoInlining)] | ||
static void MyWriteLine(int v) | ||
{ | ||
Console.WriteLine(v); | ||
if (v == 0) | ||
{ | ||
throw new Exception(); | ||
} | ||
} | ||
|
||
[MethodImplAttribute(MethodImplOptions.NoInlining)] | ||
static void Test() | ||
{ | ||
_a = 1; | ||
|
||
while (_a == 1) | ||
{ | ||
MyWriteLine(_a); | ||
_a = 0; | ||
} | ||
} | ||
|
||
static int Main() | ||
{ | ||
int result = 100; | ||
try { | ||
Test(); | ||
} | ||
catch (Exception) | ||
{ | ||
Console.WriteLine("FAILED"); | ||
result = -1; | ||
} | ||
return result; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/src/JIT/Regression/JitBlue/GitHub_26417/GitHub_26417.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,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |