Skip to content

Commit 243c587

Browse files
committed
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.
1 parent 2ff8f76 commit 243c587

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES)
170170
endif()
171171

172172
if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 15.0)
173-
list(APPEND c_compile_options "-fzero-init-padding-bits=all")
173+
list(APPEND c_compile_options "-fzero-init-padding-bits=all" "-fno-malloc-dce")
174174
endif()
175175

176176
__generate_prefix_map(prefix_map_compile_options)

0 commit comments

Comments
 (0)