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

Compiler warnings when building Python 3.8 #82502

Closed
vstinner opened this issue Sep 30, 2019 · 16 comments
Closed

Compiler warnings when building Python 3.8 #82502

vstinner opened this issue Sep 30, 2019 · 16 comments
Labels
3.8 only security fixes build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@vstinner
Copy link
Member

BPO 38321
Nosy @vsajip, @vstinner, @animalize
PRs
  • bpo-38321: Fix PyCStructUnionType_update_stgdict() warning #16492
  • bpo-38321: Fix _asynciomodule.c compiler warning #16493
  • bpo-38321: Fix _testcapimodule.c warning #16494
  • bpo-38321: Fix compiler warning in _randommodule.c #16512
  • bpo-37802: Fix a compiler warning in longobject.c #16517
  • [3.8] bpo-3832: Fix compiler warnings #16518
  • 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 2019-10-01.11:55:21.297>
    created_at = <Date 2019-09-30.10:08:44.841>
    labels = ['interpreter-core', 'build', '3.8']
    title = 'Compiler warnings when building Python 3.8'
    updated_at = <Date 2019-10-01.11:55:21.296>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-10-01.11:55:21.296>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-10-01.11:55:21.297>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2019-09-30.10:08:44.841>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38321
    keywords = ['patch']
    message_count = 16.0
    messages = ['353560', '353562', '353574', '353575', '353579', '353590', '353611', '353625', '353626', '353647', '353650', '353663', '353674', '353680', '353683', '353684']
    nosy_count = 3.0
    nosy_names = ['vinay.sajip', 'vstinner', 'malin']
    pr_nums = ['16492', '16493', '16494', '16512', '16517', '16518']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue38321'
    versions = ['Python 3.8']

    @vstinner
    Copy link
    Member Author

    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

    @vstinner vstinner added 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) build The build process and cross-build labels Sep 30, 2019
    @vstinner
    Copy link
    Member Author

    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.

    @vstinner vstinner changed the title Windows: compiler warnings when building Python 3.8 Compiler warnings when building Python 3.8 Sep 30, 2019
    @vstinner
    Copy link
    Member Author

    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

    @vstinner
    Copy link
    Member Author

    And more:

    c:\vstinner\python\master\modules\_testcapimodule.c(6409): warning C4146: unary minus operator applied to unsigned type, result still unsigned

    @vstinner
    Copy link
    Member Author

    New changeset efe74b6 by Victor Stinner in branch 'master':
    bpo-38321: Fix _asynciomodule.c compiler warning (GH-16493)
    efe74b6

    @vsajip
    Copy link
    Member

    vsajip commented Sep 30, 2019

    New changeset c9a413e by Vinay Sajip (Victor Stinner) in branch 'master':
    bpo-38321: Fix PyCStructUnionType_update_stgdict() warning (GH-16492)
    c9a413e

    @vstinner
    Copy link
    Member Author

    New changeset aca8c40 by Victor Stinner in branch 'master':
    bpo-38321: Fix _testcapimodule.c warning (GH-16494)
    aca8c40

    @animalize
    Copy link
    Mannequin

    animalize mannequin commented Oct 1, 2019

    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.

    @animalize
    Copy link
    Mannequin

    animalize mannequin commented Oct 1, 2019

    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)

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 1, 2019

    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?

    @animalize
    Copy link
    Mannequin

    animalize mannequin commented Oct 1, 2019

    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.

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 1, 2019

    New changeset 2f90261 by Victor Stinner in branch 'master':
    bpo-38321: Fix compiler warning in _randommodule.c (GH-16512)
    2f90261

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 1, 2019

    New changeset 6314abc by Victor Stinner in branch 'master':
    bpo-37802: Fix a compiler warning in longobject.c (GH-16517)
    6314abc

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 1, 2019

    New changeset bfe1f74 by Victor Stinner in branch '3.8':
    [3.8] bpo-3832: Fix compiler warnings (GH-16518)
    bfe1f74

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 1, 2019

    New changeset bfe1f74 by Victor Stinner in branch '3.8':
    [3.8] bpo-3832: Fix compiler warnings (GH-16518)
    bfe1f74

    (oops, I made a typo in the bpo number in the commit title.)

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 1, 2019

    Ok, most warnings have been fixed in 3.8 and master. I close the issue.

    @vstinner vstinner closed this as completed Oct 1, 2019
    @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
    3.8 only security fixes build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants