Skip to content

GCC 15 warnings: destination lacks 'nonstring' attribute #133256

Closed
@vstinner

Description

@vstinner

Building Python 3.14 (main branch) with GCC 15 (on Fedora 42) emits the following compiler warnings:

In file included from ./Include/internal/pycore_runtime_structs.h:68,
                 from ./Include/internal/pycore_runtime.h:11,
                 from ./Include/internal/pycore_object.h:15,
                 from ./Include/internal/pycore_dict.h:11,
                 from Python/pylifecycle.c:9:
./Include/internal/pycore_debug_offsets.h:12:26: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
   12 | #define _Py_Debug_Cookie "xdebugpy"
      |                          ^~~~~~~~~~
./Include/internal/pycore_debug_offsets.h:225:15: note: in definition of macro '_Py_DebugOffsets_INIT'
  225 |     .cookie = debug_cookie, \
      |               ^~~~~~~~~~~~
Python/pylifecycle.c:114:3: note: in expansion of macro '_PyRuntimeState_INIT'
  114 | = _PyRuntimeState_INIT(_PyRuntime, _Py_Debug_Cookie);
      |   ^~~~~~~~~~~~~~~~~~~~
Python/pylifecycle.c:114:36: note: in expansion of macro '_Py_Debug_Cookie'
  114 | = _PyRuntimeState_INIT(_PyRuntime, _Py_Debug_Cookie);
      |                                    ^~~~~~~~~~~~~~~~


./Modules/fcntlmodule.c:27:36: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
   27 | static const char guard[GUARDSZ] = "\x00\xfa\x69\xc4\x67\xa3\x6c\x58";
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions