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

ruby-changes:40961

From: nagachika <ko1@a...>
Date: Fri, 11 Dec 2015 22:52:58 +0900 (JST)
Subject: [ruby-changes:40961] nagachika:r53040 (ruby_2_2): merge revision(s) 53039: [Backport #11804]

nagachika	2015-12-11 22:52:35 +0900 (Fri, 11 Dec 2015)

  New Revision: 53040

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

  Log:
    merge revision(s) 53039: [Backport #11804]
    
    * insns.def (opt_case_dispatch): avoid converting Infinity
    
    * test/ruby/test_optimization.rb (test_opt_case_dispatch_inf): new
      [ruby-dev:49423] [Bug #11804]'

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/insns.def
    branches/ruby_2_2/test/ruby/test_optimization.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/insns.def
===================================================================
--- ruby_2_2/insns.def	(revision 53039)
+++ ruby_2_2/insns.def	(revision 53040)
@@ -1315,7 +1315,7 @@ opt_case_dispatch https://github.com/ruby/ruby/blob/trunk/ruby_2_2/insns.def#L1315
     switch(TYPE(key)) {
       case T_FLOAT: {
 	double ival;
-	if (modf(RFLOAT_VALUE(key), &ival) == 0.0) {
+	if (modf(RFLOAT_VALUE(key), &ival) == 0.0 && !isinf(ival)) {
 	    key = FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival);
 	}
       }
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 53039)
+++ ruby_2_2/ChangeLog	(revision 53040)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Dec 11 22:41:15 2015  Eric Wong  <e@8...>
+
+	* insns.def (opt_case_dispatch): avoid converting Infinity
+	* test/ruby/test_optimization.rb (test_opt_case_dispatch_inf): new
+	  [ruby-dev:49423] [Bug #11804]'
+
 Thu Dec 10 00:23:07 2015  Rei Odaira  <Rei.Odaira@g...>
 
 	* configure.in: pthread_getattr_np is broken on AIX.
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 53039)
+++ ruby_2_2/version.h	(revision 53040)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.4"
-#define RUBY_RELEASE_DATE "2015-12-10"
-#define RUBY_PATCHLEVEL 226
+#define RUBY_RELEASE_DATE "2015-12-11"
+#define RUBY_PATCHLEVEL 227
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 10
+#define RUBY_RELEASE_DAY 11
 
 #include "ruby/version.h"
 
Index: ruby_2_2/test/ruby/test_optimization.rb
===================================================================
--- ruby_2_2/test/ruby/test_optimization.rb	(revision 53039)
+++ ruby_2_2/test/ruby/test_optimization.rb	(revision 53040)
@@ -330,4 +330,15 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_optimization.rb#L330
       end;
     end
   end
+
+  def test_opt_case_dispatch_inf
+    inf = 1.0/0.0
+    result = case inf
+             when 1 then 1
+             when 0 then 0
+             else
+               inf.to_i rescue nil
+             end
+    assert_nil result, '[ruby-dev:49423] [Bug #11804]'
+  end
 end

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r53039


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

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