Skip to content

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

@dura0ok

Description

@dura0ok

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildextension-modulesC modules in the Modules dirpendingThe issue will be closed if no feedback is providedperformancePerformance or resource usagetype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions