mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
fix(build): ensure zero-init of padding bits with GCC 15+
GCC 15 introduces a regression in guaranteed zero-initialization of padding bits. The suggested solution is to add the -fzero-init-padding-bits=unions compile option. To prevent similar issues in the future, this change adds the -fzero-init-padding-bits=all build option. It ensures that padding bits in unions and structs are properly zeroed, avoiding regressions.
This commit is contained in:
@@ -169,6 +169,10 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES)
|
||||
list(APPEND compile_options "-fdump-rtl-expand")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 15.0)
|
||||
list(APPEND c_compile_options "-fzero-init-padding-bits=all")
|
||||
endif()
|
||||
|
||||
__generate_prefix_map(prefix_map_compile_options)
|
||||
list(APPEND compile_options ${prefix_map_compile_options})
|
||||
|
||||
|
Reference in New Issue
Block a user