summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-05-04 13:32:42 (GMT)
committerGitHub <noreply@github.com>2020-05-04 13:32:42 (GMT)
commitb88cd585d36d6285a5aeb0b6fdb70c134062181e (patch)
tree4c5538097274b66804c69601b1805ccbd9ee9509 /Objects
parent5e8ffe147710e449c2e935a4e2ff5cbd19828a8a (diff)
downloadcpython-b88cd585d36d6285a5aeb0b6fdb70c134062181e.zip
cpython-b88cd585d36d6285a5aeb0b6fdb70c134062181e.tar.gz
cpython-b88cd585d36d6285a5aeb0b6fdb70c134062181e.tar.bz2
bpo-40455: Remove gcc10 warning about x_digits (#19852)
* bpo-40455: Remove gcc10 warning about x_digits * bpo-40455: nit * bpo-40455: fix logic error
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index a0bb6bc..11fc75b 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -2852,7 +2852,8 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
{
Py_ssize_t a_size, a_bits, shift_digits, shift_bits, x_size;
/* See below for why x_digits is always large enough. */
- digit rem, x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT];
+ digit rem;
+ digit x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT] = {0,};
double dx;
/* Correction term for round-half-to-even rounding. For a digit x,
"x + half_even_correction[x & 7]" gives x rounded to the nearest
@@ -2902,9 +2903,7 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
if (a_bits <= DBL_MANT_DIG + 2) {
shift_digits = (DBL_MANT_DIG + 2 - a_bits) / PyLong_SHIFT;
shift_bits = (DBL_MANT_DIG + 2 - a_bits) % PyLong_SHIFT;
- x_size = 0;
- while (x_size < shift_digits)
- x_digits[x_size++] = 0;
+ x_size = shift_digits;
rem = v_lshift(x_digits + x_size, a->ob_digit, a_size,
(int)shift_bits);
x_size += a_size;