summaryrefslogtreecommitdiff
path: root/src/jit/earlyprop.cpp
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2017-09-22 17:09:09 -0700
committerGitHub <noreply@github.com>2017-09-22 17:09:09 -0700
commita11e4b1377cd1f6305782f62dcf555659625e7c2 (patch)
tree09f1bfc1a9cbf4b5d39b1de171e574701d3c49dc /src/jit/earlyprop.cpp
parent492d79e2a29ac36772e1e95b6dd3818959e99890 (diff)
parentbc407ced89e9b2a5005ffbdb1756c1fafe93f068 (diff)
downloadcoreclr-a11e4b1377cd1f6305782f62dcf555659625e7c2.tar.gz
coreclr-a11e4b1377cd1f6305782f62dcf555659625e7c2.tar.bz2
coreclr-a11e4b1377cd1f6305782f62dcf555659625e7c2.zip
Merge pull request #14117 from mikedn/earyprop-neg-length
Don't early-propagate negative array lengths
Diffstat (limited to 'src/jit/earlyprop.cpp')
-rw-r--r--src/jit/earlyprop.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jit/earlyprop.cpp b/src/jit/earlyprop.cpp
index 5a5f766575..8cb51a3fbd 100644
--- a/src/jit/earlyprop.cpp
+++ b/src/jit/earlyprop.cpp
@@ -289,9 +289,9 @@ bool Compiler::optEarlyPropRewriteTree(GenTreePtr tree)
{
assert(actualVal->IsCnsIntOrI());
- if (actualVal->gtIntCon.gtIconVal > INT32_MAX)
+ if ((actualVal->AsIntCon()->IconValue() < 0) || (actualVal->AsIntCon()->IconValue() > INT32_MAX))
{
- // Don't propagate array lengths that are beyond the maximum value of a GT_ARR_LENGTH.
+ // Don't propagate array lengths that are beyond the maximum value of a GT_ARR_LENGTH or negative.
// node. CORINFO_HELP_NEWARR_1_OBJ helper call allows to take a long integer as the
// array length argument, but the type of GT_ARR_LENGTH is always INT32.
return false;