fix(heap): avoid malloc calls optimization

GCC defines that malloc(0) returns a non-null pointer (glibc behavior).
This can break logic for some cases, because our implementation of
malloc(0) returns null pointer.
POSIX and the ISO C standard allow both behaviors.
This commit is contained in:
Alexey Lapshin
2025-05-21 18:43:25 +07:00
parent 2ff8f765ab
commit 243c587b70

View File

@@ -170,7 +170,7 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES)
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")
list(APPEND c_compile_options "-fzero-init-padding-bits=all" "-fno-malloc-dce")
endif()
__generate_prefix_map(prefix_map_compile_options)