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

Compile warnings in _pickle.c #69432

Closed
serhiy-storchaka opened this issue Sep 27, 2015 · 6 comments
Closed

Compile warnings in _pickle.c #69432

serhiy-storchaka opened this issue Sep 27, 2015 · 6 comments
Labels
build The build process and cross-build extension-modules C modules in the Modules dir

Comments

@serhiy-storchaka
Copy link
Member

BPO 25245
Nosy @benjaminp, @serhiy-storchaka
Files
  • issue25245_1.patch: Variant 1
  • issue25245_2.patch: Variant 2
  • 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 2015-09-27.08:16:30.354>
    created_at = <Date 2015-09-27.05:34:59.869>
    labels = ['extension-modules', 'build']
    title = 'Compile warnings in _pickle.c'
    updated_at = <Date 2015-09-27.08:17:17.295>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-09-27.08:17:17.295>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-09-27.08:16:30.354>
    closer = 'python-dev'
    components = ['Extension Modules']
    creation = <Date 2015-09-27.05:34:59.869>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['40592', '40593']
    hgrepos = []
    issue_num = 25245
    keywords = ['patch']
    message_count = 6.0
    messages = ['251683', '251684', '251686', '251687', '251688', '251689']
    nosy_count = 3.0
    nosy_names = ['benjamin.peterson', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue25245'
    versions = ['Python 3.4', 'Python 3.5', 'Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    Changeset 88d98f6c2d7d causes compile warnings in Modules/_pickle.c.

    /home/serhiy/py/cpython/Modules/_pickle.c: In functionload_counted_long’:
    /home/serhiy/py/cpython/Modules/_pickle.c:4752:15: warning: ‘pdatamay be used uninitialized in this function [-Wmaybe-uninitialized]
             value = _PyLong_FromByteArray((unsigned char *)pdata, (size_t)size,
                   ^
    /home/serhiy/py/cpython/Modules/_pickle.c: In functionload’:
    /home/serhiy/py/cpython/Modules/_pickle.c:5534:24: warning: ‘smay be used uninitialized in this function [-Wmaybe-uninitialized]
         idx = Py_CHARMASK(s[0]);
                            ^
    /home/serhiy/py/cpython/Modules/_pickle.c:5529:11: note: ‘swas declared here
         char *s;
               ^
    /home/serhiy/py/cpython/Modules/_pickle.c:4800:7: warning: ‘smay be used uninitialized in this function [-Wmaybe-uninitialized]
         x = _PyFloat_Unpack8((unsigned char *)s, 0);
           ^
    /home/serhiy/py/cpython/Modules/_pickle.c:4795:11: note: ‘swas declared here
         char *s;
               ^

    @serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir build The build process and cross-build labels Sep 27, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    Here are two alternative solutions.

    @benjaminp
    Copy link
    Contributor

    Why not just initially set *s to NULL in _Unpickler_Read?

    @serhiy-storchaka
    Copy link
    Member Author

    Why not just initially set *s to NULL in _Unpickler_Read?

    It would be the third variant.

    The fourth variant is to change the signature of _Unpickler_Read() and return
    char * (NULL on error). All these variants work, I examined them.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 27, 2015

    New changeset f0dcf7599517 by Benjamin Peterson in branch '3.4':
    initialize return value to NULL to avoid compiler compliants (closes bpo-25245)
    https://hg.python.org/cpython/rev/f0dcf7599517

    New changeset ef3b833b98c2 by Benjamin Peterson in branch '3.5':
    merge 3.4 (bpo-25245)
    https://hg.python.org/cpython/rev/ef3b833b98c2

    New changeset 4d23598f1428 by Benjamin Peterson in branch 'default':
    merge 3.5 (bpo-25245)
    https://hg.python.org/cpython/rev/4d23598f1428

    @python-dev python-dev mannequin closed this as completed Sep 27, 2015
    @benjaminp
    Copy link
    Contributor

    Okay, I think it might make more sense for |s| to be a return value, but that change probably isn't appropriate for bugfix releases.

    @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 extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants