summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit')
-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;