Skip to content

maybe-uninitialized compiler warnings on long_format_binary and long_to_decimal_string_internal #110819

@FFY00

Description

@FFY00

Bug report

Bug description:

I am currently getting the following compiler warnings on main

Objects/longobject.c: In function ‘long_format_binary’:
Objects/longobject.c:2120:13: warning: ‘kind’ may be used uninitialized [-Wmaybe-uninitialized]
 2120 |     else if (kind == PyUnicode_1BYTE_KIND) {
      |             ^
Objects/longobject.c:1996:9: note: ‘kind’ was declared here
 1996 |     int kind;
      |         ^~~~
Objects/longobject.c: In function ‘long_to_decimal_string_internal’:
Objects/longobject.c:1943:13: warning: ‘kind’ may be used uninitialized [-Wmaybe-uninitialized]
 1943 |     else if (kind == PyUnicode_1BYTE_KIND) {
      |             ^
Objects/longobject.c:1767:9: note: ‘kind’ was declared here
 1767 |     int kind;
      |         ^~~~
$ gcc --version
gcc (GCC) 13.2.1 20230801
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions