Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* 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
  • Loading branch information...
commit 4e4649e13cd4175aab75a0edc2fc5b082cf735d1 1 parent 3b58e17
NARUSE, Yui authored May 30, 2011

Showing 2 changed files with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  ChangeLog
  2. 2  numeric.c
5  ChangeLog
... ...
@@ -1,3 +1,8 @@
  1
+Mon May 30 10:26:51 2011  NARUSE, Yui  <naruse@ruby-lang.org>
  2
+
  3
+	* numeric.c (int_pow): make sure to assign the result of x * z.
  4
+	  If xz is optimized out, the value won't overflow.
  5
+
1 6
 Sun May 29 23:17:29 2011  NARUSE, Yui  <naruse@ruby-lang.org>
2 7
 
3 8
 	* re.c (rb_reg_match): fix rdoc of Regexp#=~.
2  numeric.c
@@ -2637,7 +2637,7 @@ int_pow(long x, unsigned long y)
2637 2637
 	    y >>= 1;
2638 2638
 	}
2639 2639
 	{
2640  
-	    long xz = x * z;
  2640
+	    volatile long xz = x * z;
2641 2641
 	    if (!POSFIXABLE(xz) || xz / x != z) {
2642 2642
 		goto bignum;
2643 2643
 	    }

0 notes on commit 4e4649e

Please sign in to comment.
Something went wrong with that request. Please try again.