[issue22463] Warnings when building on AIX

Martin Panter report at bugs.python.org
Tue Jun 21 06:50:57 EDT 2016


Martin Panter added the comment:

The most serious of these IMO is the signed overflow warnings in Modules/cPickle.c. I get the same warnings if I disable the “gcc -fwrapv” mode:

/media/disk/home/proj/python/cpython/Modules/cPickle.c: In function ‘Unpickler_noload’:
/media/disk/home/proj/python/cpython/Modules/cPickle.c:5462:1: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
 Unpickler_noload(Unpicklerobject *self, PyObject *unused)
 ^
/media/disk/home/proj/python/cpython/Modules/cPickle.c:5462:1: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
/media/disk/home/proj/python/cpython/Modules/cPickle.c:202:8: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
     if (clearto >= self->length) return 0;
        ^
/media/disk/home/proj/python/cpython/Modules/cPickle.c:202:8: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
     if (clearto >= self->length) return 0;
        ^

It is not clear to me where the overflows actually happen. See Issue 1608, Issue 1621, where some of these bugs were fixed, and the “gcc -fwrapv” workaround was enabled. Perhaps your compiler has a similar flag to use as a workaround, though IMO it would be good to fix the code as well.

Most of the other warnings have been fixed or worked around in Python 3. I propose to port the following revisions to Python 2. All but one are still in effect today:

83a55ca935f0: Parser/pgen.c
12e53abec5d0, 0c7fff783b32: Include/objimpl.h
ce9f5ce33ad2: Modules/readline.c
a7a9e0f46b8a: Modules/tkappinit.c (change present in 3.3, 3.4, but eliminated in 3.5)
e2f96bd29252 (partial): Modules/_ctypes/cfield.c
b04557ae099a (partial): Modules/expat/xmlparse.c (assuming this was the cause of the ./pyconfig.h warnings)

That leaves the two warnings about CTYPES_CAPSULE_WCHAR_T. If necessary, they could be worked around by adding an #if condition around the definitions:

#if defined(CTYPES_UNICODE) && !defined(HAVE_USABLE_WCHAR_T)
#    define CTYPES_CAPSULE_WCHAR_T "_ctypes/[. . .].c wchar_t buffer from unicode"
CTYPES_CAPSULE_INSTANTIATE_DESTRUCTOR(CTYPES_CAPSULE_WCHAR_T)
#endif

----------
nosy: +martin.panter

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


More information about the Python-bugs-list mailing list