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

ruby-changes:32048

From: marcandre <ko1@a...>
Date: Wed, 11 Dec 2013 03:19:16 +0900 (JST)
Subject: [ruby-changes:32048] marcandRe: r44127 (trunk): * insns.def: Fix optimization bug of Float#/ [Bug #9238]

marcandre	2013-12-11 03:18:31 +0900 (Wed, 11 Dec 2013)

  New Revision: 44127

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

  Log:
    * insns.def: Fix optimization bug of Float#/ [Bug #9238]

  Modified files:
    trunk/ChangeLog
    trunk/insns.def
    trunk/test/ruby/test_optimization.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44126)
+++ ChangeLog	(revision 44127)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 11 03:18:08 2013  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* insns.def: Fix optimization bug of Float#/ [Bug #9238]
+
 Tue Dec 10 23:58:30 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/date/date_strptime.c (date__strptime_internal): unset
Index: insns.def
===================================================================
--- insns.def	(revision 44126)
+++ insns.def	(revision 44127)
@@ -1511,7 +1511,7 @@ opt_div https://github.com/ruby/ruby/blob/trunk/insns.def#L1511
 	val = LONG2NUM(div);
     }
     else if (FLONUM_2_P(recv, obj) &&
-	     BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) {
+	     BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
 	val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
     }
     else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
Index: test/ruby/test_optimization.rb
===================================================================
--- test/ruby/test_optimization.rb	(revision 44126)
+++ test/ruby/test_optimization.rb	(revision 44127)
@@ -67,6 +67,7 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L67
 
   def test_fixnum_div
     assert_equal 3, 15 / 5
+    assert_equal 6.66, redefine_method('Float', '/') { 4.2 / 6.66 }, "bug 9238"
   end
 
   def test_fixnum_mod

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

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