Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b88cd58

Browse filesBrowse files
authored
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
1 parent 5e8ffe1 commit b88cd58
Copy full SHA for b88cd58

File tree

Expand file treeCollapse file tree

1 file changed

+3
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-4
lines changed

‎Objects/longobject.c

Copy file name to clipboardExpand all lines: Objects/longobject.c
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,8 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
28522852
{
28532853
Py_ssize_t a_size, a_bits, shift_digits, shift_bits, x_size;
28542854
/* See below for why x_digits is always large enough. */
2855-
digit rem, x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT];
2855+
digit rem;
2856+
digit x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT] = {0,};
28562857
double dx;
28572858
/* Correction term for round-half-to-even rounding. For a digit x,
28582859
"x + half_even_correction[x & 7]" gives x rounded to the nearest
@@ -2902,9 +2903,7 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
29022903
if (a_bits <= DBL_MANT_DIG + 2) {
29032904
shift_digits = (DBL_MANT_DIG + 2 - a_bits) / PyLong_SHIFT;
29042905
shift_bits = (DBL_MANT_DIG + 2 - a_bits) % PyLong_SHIFT;
2905-
x_size = 0;
2906-
while (x_size < shift_digits)
2907-
x_digits[x_size++] = 0;
2906+
x_size = shift_digits;
29082907
rem = v_lshift(x_digits + x_size, a->ob_digit, a_size,
29092908
(int)shift_bits);
29102909
x_size += a_size;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.