[New-bugs-announce] [issue36791] sum() relies on C signed overflow behaviour
Serhiy Storchaka
report at bugs.python.org
Sat May 4 01:54:49 EDT 2019
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
sum() assumes that an arithmetic operation on signed longs will wrap modulo 2**(bits_in_long) on overflow. However, signed overflow causes undefined behaviour according to the C standards (e.g., C99 6.5, para. 5), and gcc is known to assume that signed overflow never occurs in correct code, and to make use of this assumption when optimizing.
See also issue7406.
----------
components: Interpreter Core
messages: 341374
nosy: mark.dickinson, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: sum() relies on C signed overflow behaviour
type: behavior
versions: Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36791>
_______________________________________
More information about the New-bugs-announce
mailing list