Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings when building on AIX #66653

Closed
jelie mannequin opened this issue Sep 22, 2014 · 8 comments
Closed

Warnings when building on AIX #66653

jelie mannequin opened this issue Sep 22, 2014 · 8 comments
Labels
build The build process and cross-build

Comments

@jelie
Copy link
Mannequin

jelie mannequin commented Sep 22, 2014

BPO 22463
Nosy @vadmium

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-06-22.03:14:27.381>
created_at = <Date 2014-09-22.17:32:49.452>
labels = ['build']
title = 'Warnings when building on AIX'
updated_at = <Date 2016-06-22.03:14:27.380>
user = 'https://bugs.python.org/jelie'

bugs.python.org fields:

activity = <Date 2016-06-22.03:14:27.380>
actor = 'martin.panter'
assignee = 'none'
closed = True
closed_date = <Date 2016-06-22.03:14:27.381>
closer = 'martin.panter'
components = ['Build']
creation = <Date 2014-09-22.17:32:49.452>
creator = 'jelie'
dependencies = []
files = []
hgrepos = []
issue_num = 22463
keywords = []
message_count = 8.0
messages = ['227283', '268982', '268984', '268996', '269037', '269039', '269040', '269043']
nosy_count = 4.0
nosy_names = ['jelie', 'python-dev', 'martin.panter', 'David.Edelsohn']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue22463'
versions = ['Python 2.7']

@jelie
Copy link
Mannequin Author

jelie mannequin commented Sep 22, 2014

Building Python 2.7.8 on AIX 7.1 gives the following warnings:

Parser/pgen.c:282:9: warning: variable 'i' set but not used [-Wunused-but-set-variable]
Include/objimpl.h:164:66: warning: right-hand operand of comma expression has no effect [-Wunused-value]
/home/iulius/autobuild/src/Python-2.7.8/Modules/cPickle.c:4495:8: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
/home/iulius/autobuild/src/Python-2.7.8/Modules/cPickle.c:202:8: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
/home/iulius/autobuild/src/Python-2.7.8/Modules/readline.c:777:1: warning: 'on_completion_display_matches_hook' defined but not used [-Wunused-function]
./pyconfig.h:1182:0: warning: "_POSIX_C_SOURCE" redefined
./pyconfig.h:1204:0: warning: "_XOPEN_SOURCE" redefined
/home/iulius/autobuild/src/Python-2.7.8/Modules/tkappinit.c:29:15: warning: variable 'main_window' set but not used [-Wunused-but-set-variable]
/home/iulius/autobuild/src/Python-2.7.8/Modules/_ctypes/ctypes.h:456:13: warning: 'capsule_destructor_CTYPES_CAPSULE_WCHAR_T' defined but not used [-Wunused-function]
/home/iulius/autobuild/src/Python-2.7.8/Modules/_ctypes/cfield.c:50:29: warning: variable 'length' set but not used [-Wunused-but-set-variable]
/home/iulius/autobuild/src/Python-2.7.8/Modules/_ctypes/ctypes.h:456:13: warning: 'capsule_destructor_CTYPES_CAPSULE_WCHAR_T' defined but not used [-Wunused-function]

@jelie jelie mannequin added build The build process and cross-build labels Sep 22, 2014
@vadmium
Copy link
Member

vadmium commented Jun 21, 2016

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 bpo-1608, bpo-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

@vadmium
Copy link
Member

vadmium commented Jun 21, 2016

Looking closer at cPickle.c (after upgrading my GCC), I think there are two warnings happening, when Pdata_clear() is inlined into each of noload_reduce() and noload_setitem(). I think both cases are false positives; there is no actual signed overflow possible. Ismail Donmez has provided patches that work around this warning in bpo-1621, but IMO, and maybe in the general consensus, we shouldn’t add these workarounds.

@DavidEdelsohn
Copy link
Mannequin

DavidEdelsohn mannequin commented Jun 21, 2016

These look like false positives or noise to me as well.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 22, 2016

New changeset 0b63465a1796 by Martin Panter in branch '2.7':
Issue bpo-22463: Backport compiler warning fixes and workarounds
https://hg.python.org/cpython/rev/0b63465a1796

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 22, 2016

New changeset b1c1c297bead by Martin Panter in branch '2.7':
Issue bpo-22463: Correct #endif placement; patch by Senthil Kumaran
https://hg.python.org/cpython/rev/b1c1c297bead

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 22, 2016

New changeset ffe866aa86a8 by Martin Panter in branch '2.7':
Issue bpo-22463: Cure unused function warnings on AIX
https://hg.python.org/cpython/rev/ffe866aa86a8

@vadmium
Copy link
Member

vadmium commented Jun 22, 2016

FWIW on the current AIX buildbot <http://buildbot.python.org/all/builders/PPC64%20AIX%202.7\> I don’t see any cPickle.c warnings. (Nor on the earliest build available on that buildbot, from Nov 2015.)

@vadmium vadmium closed this as completed Jun 22, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

1 participant