classification
Title: Compiler warnings when building Python 3.8
Type: compile error Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: malin, vinay.sajip, vstinner
Priority: normal Keywords: patch

Created on 2019-09-30 10:08 by vstinner, last changed 2019-10-01 11:55 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16492 merged vstinner, 2019-09-30 14:17
PR 16493 merged vstinner, 2019-09-30 14:21
PR 16494 merged vstinner, 2019-09-30 14:23
PR 16512 merged vstinner, 2019-10-01 10:20
PR 16517 merged vstinner, 2019-10-01 11:09
PR 16518 merged vstinner, 2019-10-01 11:32
Messages (16)
msg353560 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-09-30 10:08
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winbase.h(103): warning C4005: 'Yield': macro redefinition

c:\vstinner\python\3.8\modules\_asynciomodule.c(2667): warning C4102: 'set_exception': unreferenced label

c:\vstinner\python\3.8\modules\_ctypes\stgdict.c(704): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
msg353562 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-09-30 10:16
Warnings on Linux with gcc -O3:

/home/vstinner/python/master/Modules/_randommodule.c:546:17: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  546 |     {Py_tp_doc, random_doc},
      |                 ^~~~~~~~~~


/home/vstinner/python/master/Modules/_asynciomodule.c: In function ‘task_step_impl’:
/home/vstinner/python/master/Modules/_asynciomodule.c:2660:1: warning: label ‘set_exception’ defined but not used [-Wunused-label]
 2660 | set_exception:
      | ^~~~~~~~~~~~~


In function ‘getsockaddrarg’,
    inlined from ‘sock_bind’ at /home/vstinner/python/master/Modules/socketmodule.c:3113:10:
/home/vstinner/python/master/Modules/socketmodule.c:2331:9: warning: ‘memset’ offset [17, 88] from the object at ‘addrbuf’ is out of the bounds of referenced subobject ‘sa’ with type ‘struct sockaddr’ at offset 0 [-Warray-bounds]
 2331 |         memset(sa, 0, sizeof(*sa));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~


For socketmodule: I already created bpo-38282.
msg353574 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-09-30 14:12
Other warnings:

c:\vstinner\python\master\objects\longobject.c(420): warning C4244: 'function': conversion from 'unsigned __int64' to 'sdigit', possible loss of data

c:\vstinner\python\master\objects\longobject.c(428): warning C4267: 'function': conversion from 'size_t' to 'sdigit', possible loss of data
msg353575 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-09-30 14:12
And more:

c:\vstinner\python\master\modules\_testcapimodule.c(6409): warning C4146: unary minus operator applied to unsigned type, result still unsigned
msg353579 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-09-30 14:41
New changeset efe74b6369a8d08f27c69703fcc1686966e51068 by Victor Stinner in branch 'master':
bpo-38321: Fix _asynciomodule.c compiler warning (GH-16493)
https://github.com/python/cpython/commit/efe74b6369a8d08f27c69703fcc1686966e51068
msg353590 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-09-30 15:50
New changeset c9a413ede47171a224c72dd34122005170caaad4 by Vinay Sajip (Victor Stinner) in branch 'master':
bpo-38321: Fix PyCStructUnionType_update_stgdict() warning (GH-16492)
https://github.com/python/cpython/commit/c9a413ede47171a224c72dd34122005170caaad4
msg353611 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-09-30 19:14
New changeset aca8c406ada3bb547765b262bed3ac0cc6be8dd3 by Victor Stinner in branch 'master':
bpo-38321: Fix _testcapimodule.c warning (GH-16494)
https://github.com/python/cpython/commit/aca8c406ada3bb547765b262bed3ac0cc6be8dd3
msg353625 - (view) Author: Ma Lin (malin) * Date: 2019-10-01 01:38
On my Windows, some non-ASCII characters cause this warning:

    d:\dev\cpython\modules\expat\xmltok.c : warning C4819: 
    The file contains a character that cannot be represented in
    the current code page (936). Save the file in Unicode format
    to prevent data loss.

This patch fixes the warnings, it's applicable to master/3.8 branches.
https://github.com/animalize/cpython/commit/daced7575ec70ef1f888c6854760e230cda5ea64

Maybe this trivial problem is not worth a new commit, it can be fixed along with other warnings.
msg353626 - (view) Author: Ma Lin (malin) * Date: 2019-10-01 01:55
Other warnings:

c:\vstinner\python\master\objects\longobject.c(420): warning C4244: 'function': conversion from 'unsigned __int64' to 'sdigit', possible loss of data

c:\vstinner\python\master\objects\longobject.c(428): warning C4267: 'function': conversion from 'size_t' to 'sdigit', possible loss of data
-----------------
These warnings only appear in master branch, I will fix it at some point.
(https://bugs.python.org/issue35696#msg352903)
msg353647 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-01 08:22
> d:\dev\cpython\modules\expat\xmltok.c

This file is copied directly from https://github.com/libexpat/libexpat/ project. Would you mind to propose your patch there?
msg353650 - (view) Author: Ma Lin (malin) * Date: 2019-10-01 08:28
> This file is copied directly from https://github.com/libexpat/libexpat/ > project. Would you mind to propose your patch there?

ok, I will report to there.
msg353663 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-01 10:45
New changeset 2f90261280e36a179831d72ce794115be31c88bb by Victor Stinner in branch 'master':
bpo-38321: Fix compiler warning in _randommodule.c (GH-16512)
https://github.com/python/cpython/commit/2f90261280e36a179831d72ce794115be31c88bb
msg353674 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-01 11:29
New changeset 6314abcc08f5d0f3d3a915dc9455ea223fa65517 by Victor Stinner in branch 'master':
bpo-37802: Fix a compiler warning in longobject.c (GH-16517)
https://github.com/python/cpython/commit/6314abcc08f5d0f3d3a915dc9455ea223fa65517
msg353680 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-01 11:52
New changeset bfe1f74e39d0049a829962050e86a6a2d2a2781e by Victor Stinner in branch '3.8':
[3.8] bpo-3832: Fix compiler warnings (GH-16518)
https://github.com/python/cpython/commit/bfe1f74e39d0049a829962050e86a6a2d2a2781e
msg353683 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-01 11:54
New changeset bfe1f74e39d0049a829962050e86a6a2d2a2781e by Victor Stinner in branch '3.8':
[3.8] bpo-3832: Fix compiler warnings (GH-16518)
https://github.com/python/cpython/commit/bfe1f74e39d0049a829962050e86a6a2d2a2781e

(oops, I made a typo in the bpo number in the commit title.)
msg353684 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-01 11:55
Ok, most warnings have been fixed in 3.8 and master. I close the issue.
History
Date User Action Args
2019-10-01 11:55:21vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg353684

stage: patch review -> resolved
2019-10-01 11:54:45vstinnersetmessages: + msg353683
2019-10-01 11:52:03vstinnersetmessages: + msg353680
2019-10-01 11:32:48vstinnersetpull_requests: + pull_request16109
2019-10-01 11:29:56vstinnersetmessages: + msg353674
2019-10-01 11:09:51vstinnersetpull_requests: + pull_request16108
2019-10-01 10:45:55vstinnersetmessages: + msg353663
2019-10-01 10:20:59vstinnersetpull_requests: + pull_request16102
2019-10-01 08:28:24malinsetmessages: + msg353650
2019-10-01 08:22:25vstinnersetmessages: + msg353647
2019-10-01 01:55:17malinsetmessages: + msg353626
2019-10-01 01:38:55malinsetnosy: + malin
messages: + msg353625
2019-09-30 19:14:48vstinnersetmessages: + msg353611
2019-09-30 15:50:05vinay.sajipsetnosy: + vinay.sajip
messages: + msg353590
2019-09-30 14:41:39vstinnersetmessages: + msg353579
2019-09-30 14:23:37vstinnersetpull_requests: + pull_request16082
2019-09-30 14:21:23vstinnersetpull_requests: + pull_request16080
2019-09-30 14:17:32vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request16078
2019-09-30 14:12:52vstinnersetmessages: + msg353575
2019-09-30 14:12:24vstinnersetmessages: + msg353574
2019-09-30 10:17:01vstinnersettitle: Windows: compiler warnings when building Python 3.8 -> Compiler warnings when building Python 3.8
2019-09-30 10:16:56vstinnersetmessages: + msg353562
2019-09-30 10:08:44vstinnercreate