On 2023-09-10 15:13, Страхиња Радић wrote:
> What is weird is that tcc requires a libc function, memset, when none
> is
> explicitly requested, when for example this code:
It is not that weird I think. Early versions of GCC generates a call to
memset()
as well when zeroing a block of memory [1]
btw, the call could be easily eliminated by add a function like
gen_struct_copy()
in x86_64-gen.c. And this call may lead to problems. For example, the
dynamic
linker of musl has code that zeros a structure, but at that time
memset() has not
been relocated, result in a segfault.
--
Ziyao
[1]: check for clear_storage() in gcc/expr.c of commit 3b6f75e2 of gcc