mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
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]' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@53040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
80f81024c3
commit
03ad9a258e
4 changed files with 21 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
Fri Dec 11 22:41:15 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* 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@gmail.com>
|
||||
|
||||
* configure.in: pthread_getattr_np is broken on AIX.
|
||||
|
|
|
@ -1315,7 +1315,7 @@ opt_case_dispatch
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,4 +330,15 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||
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
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#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"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue