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

ruby-changes:60706

From: Yusuke <ko1@a...>
Date: Thu, 9 Apr 2020 09:15:06 +0900 (JST)
Subject: [ruby-changes:60706] 1a4f33e84e (master): numeric.c: Remove unreachable code

https://git.ruby-lang.org/ruby.git/commit/?id=1a4f33e84e

From 1a4f33e84e0633e8f953ee3cb06b42dcc952444a Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 9 Apr 2020 09:14:02 +0900
Subject: numeric.c: Remove unreachable code

b cannot be <= 0 here.  Found by Coverity Scan

diff --git a/numeric.c b/numeric.c
index 40a381f..e0729a2 100644
--- a/numeric.c
+++ b/numeric.c
@@ -4079,10 +4079,7 @@ fix_pow(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4079
 
 	if (b == 0) return INT2FIX(1);
 	if (b == 1) return x;
-	if (a == 0) {
-	    if (b > 0) return INT2FIX(0);
-	    return DBL2NUM(HUGE_VAL);
-	}
+	if (a == 0) return INT2FIX(0);
 	return int_pow(a, b);
     }
     else if (RB_TYPE_P(y, T_BIGNUM)) {
-- 
cgit v0.10.2


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

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