aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-30 01:28:37 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-30 01:28:37 +0000
commit4e4649e13cd4175aab75a0edc2fc5b082cf735d1 (patch)
treed1a87441c848bb19989cf86167658479ac32ffc0
parent3b58e17d7bc1c2afe0d7b8190f1b113f3138063a (diff)
downloadruby-4e4649e13cd4175aab75a0edc2fc5b082cf735d1.tar.gz
* numeric.c (int_pow): make sure to assign the result of x * z.
If xz is optimized out, the value won't overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--numeric.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 45ae085de9..73d38ac676 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon May 30 10:26:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (int_pow): make sure to assign the result of x * z.
+ If xz is optimized out, the value won't overflow.
+
Sun May 29 23:17:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
* re.c (rb_reg_match): fix rdoc of Regexp#=~.
diff --git a/numeric.c b/numeric.c
index 09860dc6f2..1b80a2b6e0 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2637,7 +2637,7 @@ int_pow(long x, unsigned long y)
y >>= 1;
}
{
- long xz = x * z;
+ volatile long xz = x * z;
if (!POSFIXABLE(xz) || xz / x != z) {
goto bignum;
}