Skip to content

Build fails with GCC 15 due to -Wunterminated-string-initialization #16692

@stratakis

Description

@stratakis

Port, board and/or hardware

x86_64

MicroPython version

1.24.1

Reproduction

When compiling micropython on Fedora with the latest GCC 15, a new warning is now enabled by default through -Wextra: -Wunterminated-string-initialization.

This makes the compilation fail for the arrays at:
https://github.com/micropython/micropython/blob/master/py/emitinlinethumb.c#L152
https://github.com/micropython/micropython/blob/v1.24.1/py/emitinlinethumb.c#L370
https://github.com/micropython/micropython/blob/v1.24.1/py/emitinlinethumb.c#L391
https://github.com/micropython/micropython/blob/v1.24.1/py/emitinlinethumb.c#L430
https://github.com/micropython/micropython/blob/master/py/emitinlinextensa.c#L121

Expected behaviour

Compilation passes.

Observed behaviour

These errors are observed for each array element.

../py/emitinlinextensa.c:122:9: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 122 | {0, "a0\0"}

../py/emitinlinethumb.c:153:9: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 153 | {0, "r0\0"}

../py/emitinlinethumb.c:371:24: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 371 | { ASM_THUMB_CC_EQ, "eq" }

../py/emitinlinethumb.c:394:34: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization] 394 | { X(ASM_THUMB_FORMAT_4_LSR), "lsr" },

../py/emitinlinethumb.c:431:13: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization] 431 | { 0x30, "add" },

Full build.log is attached.

Additional Information

Similar issues from other projects:
Mbed-TLS/mbedtls#9944
besser82/libxcrypt#194

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions