summaryrefslogtreecommitdiff
path: root/src/jit/codegenlegacy.cpp
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2017-07-24 15:31:33 -0700
committerBruce Forstall <brucefo@microsoft.com>2017-07-24 15:31:33 -0700
commit4357d466536d9aac61085c540f673f3fcff6a847 (patch)
tree6cf0e765354a8c108d0164edf97dea628fc6bafc /src/jit/codegenlegacy.cpp
parent9b0906b652c717abecfb8b5358023d0e24cb71f5 (diff)
downloadcoreclr-4357d466536d9aac61085c540f673f3fcff6a847.tar.gz
coreclr-4357d466536d9aac61085c540f673f3fcff6a847.tar.bz2
coreclr-4357d466536d9aac61085c540f673f3fcff6a847.zip
Handle error case when looking for reg pair
When performing unsigned up-cast to long, if needReg was computed with exactly 2 bits, then rsFindRegPairNo() is called to find the corresponding reg pair. This can fail if one of the needReg bits is in the reserved set (rsMaskResvd), as was the case in this test on ARM for R10. Add logic to handle this error return. The same logic already existed in the signed cast case. Fixes #12886
Diffstat (limited to 'src/jit/codegenlegacy.cpp')
-rw-r--r--src/jit/codegenlegacy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index 69a74477b0..44f790ff9b 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -14672,7 +14672,7 @@ void CodeGen::genCodeForTreeLng(GenTreePtr tree, regMaskTP needReg, regMaskTP av
if (!genMaxOneBit(needReg))
{
regPair = regSet.rsFindRegPairNo(needReg);
- if (needReg != genRegPairMask(regPair))
+ if ((regPair == REG_PAIR_NONE) || (needReg != genRegPairMask(regPair)))
goto ANY_FREE_REG_UNSIGNED;
loRegMask = genRegMask(genRegPairLo(regPair));
if ((loRegMask & regSet.rsRegMaskCanGrab()) == 0)