ruby-changes:41072
From: usa <ko1@a...>
Date: Wed, 16 Dec 2015 16:11:54 +0900 (JST)
Subject: [ruby-changes:41072] usa:r53147 (ruby_2_1): merge revision(s) 53039: [Backport #11804]
usa 2015-12-16 16:11:41 +0900 (Wed, 16 Dec 2015) New Revision: 53147 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53147 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_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/insns.def branches/ruby_2_1/test/ruby/test_optimization.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 53146) +++ ruby_2_1/ChangeLog (revision 53147) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Wed Dec 16 16:10:52 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]' + Wed Dec 16 16:07:29 2015 Rei Odaira <Rei.Odaira@g...> * configure.in: pthread_getattr_np is broken on AIX. Index: ruby_2_1/insns.def =================================================================== --- ruby_2_1/insns.def (revision 53146) +++ ruby_2_1/insns.def (revision 53147) @@ -1275,7 +1275,7 @@ opt_case_dispatch https://github.com/ruby/ruby/blob/trunk/ruby_2_1/insns.def#L1275 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_1/version.h =================================================================== --- ruby_2_1/version.h (revision 53146) +++ ruby_2_1/version.h (revision 53147) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.8" #define RUBY_RELEASE_DATE "2015-12-16" -#define RUBY_PATCHLEVEL 436 +#define RUBY_PATCHLEVEL 437 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 12 Index: ruby_2_1/test/ruby/test_optimization.rb =================================================================== --- ruby_2_1/test/ruby/test_optimization.rb (revision 53146) +++ ruby_2_1/test/ruby/test_optimization.rb (revision 53147) @@ -242,4 +242,15 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_optimization.rb#L242 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_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r53039 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/