Issue 19418: audioop.c giving signed/unsigned warnings on Windows (original) (raw)

Issue19418

Created on 2013-10-27 19:44 by tim.golden, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue19418.2.diff tim.golden,2013-10-28 20:49 review
Pull Requests
URL Status Linked Edit
PR 7453 merged vstinner,2018-06-06 15:17
Messages (17)
msg201485 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-27 19:44
Modules/audioop.c is giving compile warnings on Windows against lines 18 & 437. ..\Modules\audioop.c(18): warning C4146: unary minus operator applied to unsigned type, result still unsigned ..\Modules\audioop.c(437): warning C4146: unary minus operator applied to unsigned type, result still unsigned
msg201486 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-27 19:46
The attached patch appears to fix the problem.
msg201490 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-27 20:16
But it adds warnings on 32-bit platform with GCC. /home/serhiy/py/cpython/Modules/audioop.c🔞61: warning: integer overflow in expression [-Woverflow] /home/serhiy/py/cpython/Modules/audioop.c: In function ‘audioop_minmax’: /home/serhiy/py/cpython/Modules/audioop.c:437:33: warning: integer overflow in expression [-Woverflow]
msg201491 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-27 20:19
What if use (int)-0x80000000 instead of -(int)0x80000000? Does it silence warnings on Windows?
msg201492 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-27 20:20
I don't think it will, given MS description of the compiler warning: http://msdn.microsoft.com/en-us/library/4kh09110%28v=vs.100%29.aspx but I'll certainly give it a go.
msg201495 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2013-10-27 20:42
Use -0x7FFFFFFF-1 Nobody should complain about that, because it's standard C ;-) On Sun, Oct 27, 2013 at 3:20 PM, Tim Golden <report@bugs.python.org> wrote: > > Tim Golden added the comment: > > I don't think it will, given MS description of the compiler warning: > > http://msdn.microsoft.com/en-us/library/4kh09110%28v=vs.100%29.aspx > > but I'll certainly give it a go. > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue19418> > _______________________________________ > _______________________________________________ > Python-bugs-list mailing list > Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/tim.peters%40gmail.com >
msg201496 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-27 20:46
LGTM. Do you want commit a patch?
msg201499 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2013-10-27 20:58
@Serhiy, nope, pressed for time today :-(
msg201501 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-27 21:05
Good idea. I'll test against Win32/64 & Linux 32
msg201575 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-28 20:31
The attached patch (using Tim Peters' -1 trick) builds & tests ok on Win32/64 & Linux 32.
msg201576 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-10-28 20:37
You should add a comment to explain why the trick is required (because of compilers not supporting -0x80000000 literal without a warning).
msg201579 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-28 20:49
Good point. Updated patch.
msg201584 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-28 21:21
LGTM.
msg201798 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-31 10:52
New changeset 0848c90a5dd1 by Tim Golden in branch 'default': Issue #19418 Fix some warnings on Win64 http://hg.python.org/cpython/rev/0848c90a5dd1
msg201833 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-31 17:40
New changeset 54bf7b5ec3b6 by Tim Golden in branch '3.3': Issue #19418 Fix some warnings on Win64 http://hg.python.org/cpython/rev/54bf7b5ec3b6
msg201835 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-31 17:51
Fixed in 3.3 / 3.4
msg318836 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-06 15:51
New changeset e5b79c546370521764457ea2ec809303e580f5ea by Victor Stinner in branch '2.7': bpo-19418: audioop.c: Fix warnings on -0x80000000 (GH-7453) https://github.com/python/cpython/commit/e5b79c546370521764457ea2ec809303e580f5ea
History
Date User Action Args
2022-04-11 14:57:52 admin set github: 63617
2018-06-06 15:51:10 vstinner set messages: +
2018-06-06 15:17:48 vstinner set pull_requests: + <pull%5Frequest7075>
2013-10-31 17:51:52 tim.golden set status: open -> closedversions: - Python 2.7messages: + resolution: fixedstage: commit review -> resolved
2013-10-31 17:40:56 python-dev set messages: +
2013-10-31 10:52:07 python-dev set nosy: + python-devmessages: +
2013-10-28 21:21:53 serhiy.storchaka set messages: +
2013-10-28 20:50:22 tim.golden set files: - issue19418.diff
2013-10-28 20:49:56 tim.golden set files: + issue19418.2.diffmessages: +
2013-10-28 20:37:00 vstinner set nosy: + vstinnermessages: +
2013-10-28 20:31:26 tim.golden set files: - audioop.diff
2013-10-28 20:31:16 tim.golden set files: + issue19418.diffmessages: +
2013-10-27 21:05:23 tim.golden set messages: +
2013-10-27 20:58:17 tim.peters set messages: +
2013-10-27 20:46:32 serhiy.storchaka set stage: commit reviewmessages: + versions: + Python 2.7, Python 3.3
2013-10-27 20:42:25 tim.peters set nosy: + tim.petersmessages: +
2013-10-27 20:20:49 tim.golden set messages: +
2013-10-27 20:19:10 serhiy.storchaka set messages: +
2013-10-27 20:16:38 serhiy.storchaka set messages: +
2013-10-27 19:46:05 tim.golden set files: + audioop.diffkeywords: + patchmessages: +
2013-10-27 19:44:37 tim.golden create