From ef34a256d565c1f57fbbbac7736ac6b437610b62 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Wed, 21 Aug 2024 00:40:56 +0200 Subject: [PATCH] Fix infinite loop in genAddrMode --- src/coreclr/jit/codegencommon.cpp | 3 +- .../JitBlue/Runtime_106607/Runtime_106607.il | 40 +++++++++++++++++++ .../Runtime_106607/Runtime_106607.ilproj | 9 +++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.il create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.ilproj diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index 0598d968e73881..9920f9846d2732 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -1365,9 +1365,8 @@ bool CodeGen::genCreateAddrMode(GenTree* addr, { cns += addConst->IconValue(); op2 = op2->AsOp()->gtOp1; + goto AGAIN; } - - goto AGAIN; } break; #endif // TARGET_XARCH diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.il b/src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.il new file mode 100644 index 00000000000000..8eba69b7303605 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.il @@ -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 + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.ilproj b/src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.ilproj new file mode 100644 index 00000000000000..4b3a54c1abb8a4 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106607/Runtime_106607.ilproj @@ -0,0 +1,9 @@ + + + None + True + + + + +