This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Legit compiler warnings in new pickle code on 32-bit Windows
Type: Stage:
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: alexandre.vassalotti Nosy List: alexandre.vassalotti, christian.heimes, pitrou, python-dev, tim.peters, zach.ware
Priority: normal Keywords: patch

Created on 2013-11-23 19:51 by tim.peters, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue19739.diff zach.ware, 2013-11-25 18:32 review
Messages (7)
msg204084 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2013-11-23 19:51
1>..\Modules\_pickle.c(710): warning C4293: '>>' : shift count negative or too big, undefined behavior
1>..\Modules\_pickle.c(711): warning C4293: '>>' : shift count negative or too big, undefined behavior
1>..\Modules\_pickle.c(712): warning C4293: '>>' : shift count negative or too big, undefined behavior
1>..\Modules\_pickle.c(713): warning C4293: '>>' : shift count negative or too big, undefined behavior
1>..\Modules\_pickle.c(1158): warning C4018: '<' : signed/unsigned mismatch

The first 4 should be easy to fix by using a SIZEOF_SIZE_T >= 8 #ifdef test.  The last is on:

        if (frame_len < n) { ... raise an exception ...

where `frame_len` is size_t and `n` is Py_ssize_t.
msg204086 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-23 19:52
Yes, there is actually a bug which shows up as errors in the tests. I'm currently testing a patch for it.
msg204102 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-23 20:40
I've fixed the first 4 in 458340ed0606 and the signed/unsigned warning in c3fd79b17983.
msg204369 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-25 17:27
This appears to be back with slightly different line numbers:

..\Modules\_pickle.c(718): warning C4293: '>>' : shift count negative or too big, undefined behavior
..\Modules\_pickle.c(719): warning C4293: '>>' : shift count negative or too big, undefined behavior
..\Modules\_pickle.c(720): warning C4293: '>>' : shift count negative or too big, undefined behavior
..\Modules\_pickle.c(721): warning C4293: '>>' : shift count negative or too big, undefined behavior
..\Modules\_pickle.c(1647): warning C4146: unary minus operator applied to unsigned type, result still unsigned

Seems to have been caused by 14f2776686b3.
msg204379 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-25 18:32
The attached patch fixes the warnings and doesn't appear to break anything obvious.

The first 4 are fixed by reverting Alexandre's change from '#if SIZEOF_SIZE_T' to 'if (sizeof(size_t)'.

The last one is different from the original 5th warning, and is fixed using the same trick that has been used in Modules/audioop.c; that is, use '(-0x7fffffffL - 1)' rather than '-0x80000000L', which MSVC can't seem to handle.
msg204383 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-25 19:36
New changeset f8ac01a762c1 by Alexandre Vassalotti in branch 'default':
Issue #19739: Try to fix compiler warnings on 32-bit Windows.
http://hg.python.org/cpython/rev/f8ac01a762c1
msg204416 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2013-11-25 21:28
Thanks Zachary for the notice! Look like my change fixed the warnings on the Windows x86 build.

http://buildbot.python.org/all/builders/x86%20Windows%20Server%202008%20%5BSB%5D%203.x/builds/1801
History
Date User Action Args
2022-04-11 14:57:54adminsetgithub: 63938
2013-11-25 21:28:30alexandre.vassalottisetstatus: open -> closed
resolution: fixed
messages: + msg204416
2013-11-25 19:36:17python-devsetnosy: + python-dev
messages: + msg204383
2013-11-25 18:32:37zach.waresetfiles: + issue19739.diff
keywords: + patch
messages: + msg204379
2013-11-25 17:49:30christian.heimessetnosy: + christian.heimes
2013-11-25 17:27:48zach.waresetstatus: closed -> open

nosy: + zach.ware
messages: + msg204369

resolution: fixed -> (no value)
stage: resolved ->
2013-11-23 20:40:00pitrousetstatus: open -> closed
resolution: fixed
messages: + msg204102

stage: resolved
2013-11-23 19:52:00pitrousetmessages: + msg204086
2013-11-23 19:51:04tim.peterscreate