summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2015-09-11 12:04:31 -0700
committerBruce Forstall <brucefo@microsoft.com>2015-09-11 12:04:31 -0700
commit81291720abef64f07db0b01162b4ee1bde4ff7f8 (patch)
tree153a6f6ccfd1f16e9179530c0956a87c9c65e876 /src/jit
parentff51d9e5384a61d22342aa640deafe62ec5a8754 (diff)
downloadcoreclr-81291720abef64f07db0b01162b4ee1bde4ff7f8.tar.gz
coreclr-81291720abef64f07db0b01162b4ee1bde4ff7f8.tar.bz2
coreclr-81291720abef64f07db0b01162b4ee1bde4ff7f8.zip
Replace 'long' by 'int' to avoid bug on Linux
In GetSignedMagicNumberDivide(), a cast to (unsigned long) was doing a sign extend instead of a zero extend, leading to an apparent infinite loop with test case b147814_il.exe. This change replaces the cast with (unsigned int), which matches Windows behavior.
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/morph.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 2eb5b53621..f3eb506b0d 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -11076,7 +11076,7 @@ T GetSignedMagicNumberForDivide(T denom, int *shift /*out*/)
int iters = 0;
absDenom = abs(denom);
- t = two_nminus1 + ((unsigned long)denom >> 31);
+ t = two_nminus1 + ((unsigned int)denom >> 31);
absNc = t - 1 - (t % absDenom); // absolute value of nc
p = bits_minus_1; // initialize p
q1 = two_nminus1 / absNc; // initialize q1 = 2^p / abs(nc)