Skip to content

LTO build triggers warnings in _decimal and bltinmodule.c #132423

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

Closed
dura0ok opened this issue Apr 12, 2025 · 3 comments
Closed

LTO build triggers warnings in _decimal and bltinmodule.c #132423

dura0ok opened this issue Apr 12, 2025 · 3 comments
Labels
build The build process and cross-build extension-modules C modules in the Modules dir pending The issue will be closed if no feedback is provided performance Performance or resource usage type-bug An unexpected behavior, bug, or error

Comments

@dura0ok
Copy link
Contributor

dura0ok commented Apr 12, 2025

Bug report

Bug description:

When building CPython with --enable-optimizations --with-lto using gcc, the following warnings are triggered:

1. _decimal module

./Modules/_decimal/libmpdec/io.c:378:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
lto1: note: destination object is likely at address zero

This occurs in word_to_string, inlined into coeff_to_string.

2. bltinmodule.c

./Include/internal/pycore_call.h:166:16: warning: ‘small_stack’ may be used uninitialized [-Wmaybe-uninitialized]
Python/bltinmodule.c:1412:15: note: ‘small_stack’ declared here

This happens in map_next, calling _PyObject_MakeTpCall.

  • Build flags: --enable-optimizations --with-lto, -O3 -flto -Wall -Wextra
|              ^
In function ‘coeff_to_string’:
lto1: note: destination object is likely at address zero
In function ‘word_to_string’,
    inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:418:13:
./Modules/_decimal/libmpdec/io.c:378:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  378 |     case 2:  EXTRACT_DIGIT(s, x, 10UL, dot);
      |              ^
In function ‘coeff_to_string’:
lto1: note: destination object is likely at address zero
lto1: note: destination object is likely at address zero
In function ‘word_to_string’,
    inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:418:13:
./Modules/_decimal/libmpdec/io.c:378:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
In function ‘coeff_to_string’:
lto1: note: destination object is likely at address zero





CPython versions tested on:

3.14

Operating systems tested on:

Linux

@dura0ok dura0ok added the type-bug An unexpected behavior, bug, or error label Apr 12, 2025
@picnixz picnixz added extension-modules C modules in the Modules dir build The build process and cross-build performance Performance or resource usage labels Apr 12, 2025
@picnixz
Copy link
Member

picnixz commented Apr 12, 2025

./Modules/_decimal/libmpdec/io.c:378:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]

For this one, I don't know if we can touch it as it's a vendored module.

@skirpichev
Copy link
Contributor

See #108562. I suspect this might be closed as a duplicate.

@skirpichev skirpichev added the pending The issue will be closed if no feedback is provided label Apr 12, 2025
@chris-eibl
Copy link
Member

  1. bltinmodule.c

This is a duplicate of #132314.

@picnixz picnixz closed this as completed Apr 12, 2025
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 pending The issue will be closed if no feedback is provided performance Performance or resource usage type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants