Skip to content

Commit

Permalink
Fix infinite loop in genAddrMode (#106766)
Browse files Browse the repository at this point in the history
Co-authored-by: EgorBo <egorbo@gmail.com>
Co-authored-by: Jeff Schwartz <jeffschw@microsoft.com>
  • Loading branch information
3 people authored Aug 22, 2024
1 parent 7384dc4 commit 0128ecb
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1365,9 +1365,8 @@ bool CodeGen::genCreateAddrMode(GenTree* addr,
{
cns += addConst->IconValue();
op2 = op2->AsOp()->gtOp1;
goto AGAIN;
}

goto AGAIN;
}
break;
#endif // TARGET_XARCH
Expand Down
40 changes: 40 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.il
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.

.assembly extern System.Runtime { }
.assembly extern System.Console { }
.assembly extern xunit.core { }
.assembly Runtime_106607 { }

.class Runtime_106607 extends [System.Runtime]System.Object
{
.method public static int32 Main() nooptimization
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
.maxstack 8
.locals init ([0] int32 num)

ldc.i4 42
stloc.0
ldloc.0
ldc.i4 1620763441
ldc.i4 1453536392
add
add
ldloc.0
ldloc.0
sub
ldc.i4 152872638
ldc.i4.s 31
and
shl
add
call void [System.Console]System.Console::WriteLine(int32)

ldc.i4 100
ret
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).il" />
</ItemGroup>
</Project>

0 comments on commit 0128ecb

Please sign in to comment.