Mark Dickinson added the comment:

Thanks for this. I took a look at the 5 reports for Objects/longobject.c, and I 
don't think there's any action to be taken on any of them. (Two false 
positives; two "dead assignments" that are used when asserts are enabled, and 
one division-by-zero that depends on a function being called in a way that 
never happens in practice.)

* Objects/longobject.c:2823 Assigned value is garbage or undefined

This is a false positive. Here we have:

    a_bits <= a_size * PyLongShift
    shift_digits = (a_bits - DBL_MANT_DIG - 2) / PyLong_SHIFT;

and then we call v_rshift(x_digits, ..., a_size - shift_digits, ...), which 
fills the first a_size - shift_digits entries of x_digits. Since DBL_MANT_DIG 
>= PyLong_SHIFT, we have shift_digits < a_size, so x_digits[0] is always 
initialised by v_rshift.

* Objects/longobject.c:2723 Dead assignment

The value of the assignment is used in a following assert statement; I don't 
think this should be changed.

* Objects/longobject.c:2463 Dead assignment

Again, the value of the assignment is used in an assert.

* Objects/longobject.c:1828 Division by zero

This function will never get called with bits=0. There are asserts to check 
this.

* Objects/longobject.c:2830 Assigned value is garbage or undefined

This is another false positive, similar to the first one. Analysing the 
arithmetic shows that x_digits[0] is always defined.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30287>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to