[issue20947] -Wstrict-overflow findings

Serhiy Storchaka report at bugs.python.org
Sun Sep 25 10:34:11 EDT 2016


Serhiy Storchaka added the comment:

I can reproduce warnings in Modules/_posixsubprocess.c:

gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-overflow -I./Include -I. -I/usr/include/i386-linux-gnu -I/usr/local/include -I/home/serhiy/py/cpython/Include -I/home/serhiy/py/cpython -c /home/serhiy/py/cpython/Modules/_posixsubprocess.c -o build/temp.linux-i686-3.7/home/serhiy/py/cpython/Modules/_posixsubprocess.o
/home/serhiy/py/cpython/Modules/_posixsubprocess.c: In function ‘child_exec’:
/home/serhiy/py/cpython/Modules/_posixsubprocess.c:524:33: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]
         while (saved_errno != 0 && cur > hex_errno) {
                                 ^
/home/serhiy/py/cpython/Modules/_posixsubprocess.c: In function ‘subprocess_fork_exec’:
/home/serhiy/py/cpython/Modules/_posixsubprocess.c:524:33: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]
         while (saved_errno != 0 && cur > hex_errno) {
                                 ^
/home/serhiy/py/cpython/Modules/_posixsubprocess.c:544:1: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]
 subprocess_fork_exec(PyObject* self, PyObject *args)
 ^
/home/serhiy/py/cpython/Modules/_posixsubprocess.c:544:1: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]
/home/serhiy/py/cpython/Modules/_posixsubprocess.c:524:33: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]
         while (saved_errno != 0 && cur > hex_errno) {
                                 ^
/home/serhiy/py/cpython/Modules/_posixsubprocess.c:524:33: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]

Proposed simple patch fixes this.

----------
assignee:  -> serhiy.storchaka
keywords: +patch
resolution: wont fix -> 
stage: resolved -> patch review
status: closed -> open
versions: +Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44820/issue20947.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20947>
_______________________________________


More information about the Python-bugs-list mailing list