[PATCH v5 0/6] Add support for LoongArch32

mengqinggang mengqinggang@loongson.cn
Wed Mar 11 06:58:02 GMT 2026


在 2026/3/11 13:10, Xi Ruoyao 写道:
> On Wed, 2026-03-04 at 16:41 +0800, mengqinggang wrote:
>>> If wordsize is 64, there is an int __pad0.
>>> Maybe this difference causes the loongarch64 gcc to generate call
>>> memset,
>>> while the loongarch32 gcc does not.
>>
>> On 32 bit target, gcc believes all fields have been initialized. So
>> gcc
>> dose not generate call memset.
> This is not true.  The C standard does not require to initialize all the
> fields in this case, so gcc do not need to generate the memset call no
> matter if someone has initialized those fields.
>
> GCC generate the memset call on LA64 is just a bug, I've reported it as
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124356.


Is this the relevant C standard?

If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate.


>> Currently, I think  add a memset call in source code is a good idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260311/9948aae1/attachment-0001.htm>


More information about the Libc-alpha mailing list