[前][次][番号順一覧][スレッド一覧]

ruby-changes:19760

From: naruse <ko1@a...>
Date: Mon, 30 May 2011 10:30:34 +0900 (JST)
Subject: [ruby-changes:19760] naruse:r31805 (trunk): * numeric.c (int_pow): make sure to assign the result of x * z.

naruse	2011-05-30 10:28:37 +0900 (Mon, 30 May 2011)

  New Revision: 31805

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31805

  Log:
    * numeric.c (int_pow): make sure to assign the result of x * z.
      If xz is optimized out, the value won't overflow.

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31804)
+++ ChangeLog	(revision 31805)
@@ -1,3 +1,8 @@
+Mon May 30 10:26:51 2011  NARUSE, Yui  <naruse@r...>
+
+	* 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@r...>
 
 	* re.c (rb_reg_match): fix rdoc of Regexp#=~.
Index: numeric.c
===================================================================
--- numeric.c	(revision 31804)
+++ numeric.c	(revision 31805)
@@ -2637,7 +2637,7 @@
 	    y >>= 1;
 	}
 	{
-	    long xz = x * z;
+	    volatile long xz = x * z;
 	    if (!POSFIXABLE(xz) || xz / x != z) {
 		goto bignum;
 	    }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]