public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc.
@ 2020-10-30  8:53 YaRu Wei(魏亚茹)
  2020-11-04 15:45 ` Richard Earnshaw
  0 siblings, 1 reply; 3+ messages in thread
From: YaRu Wei(魏亚茹) @ 2020-10-30  8:53 UTC (permalink / raw)
  To: gcc

Dear gcc:
I find that disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc. I want to know under what circumstances malloc will be optimized to calloc?
Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc.
  2020-10-30  8:53 Disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc YaRu Wei(魏亚茹)
@ 2020-11-04 15:45 ` Richard Earnshaw
  2020-11-05  1:06   ` 答复: " YaRu Wei(魏亚茹)
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Earnshaw @ 2020-11-04 15:45 UTC (permalink / raw)
  To: YaRu Wei(魏亚茹), gcc

On 30/10/2020 08:53, YaRu Wei(魏亚茹) wrote:
> Dear gcc:
> I find that disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc. I want to know under what circumstances malloc will be optimized to calloc?
> Thanks
> 

I would presume this would happen if the call to malloc were immediately
followed by a call to memset to clear the memory (or an equivalent
software coded implementation of memset were detected).  Generally,
calloc has a better idea of the memory being allocated and can optimize
the clearing step if it knows the memory is already zeroed.

R.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: Disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc.
  2020-11-04 15:45 ` Richard Earnshaw
@ 2020-11-05  1:06   ` YaRu Wei(魏亚茹)
  0 siblings, 0 replies; 3+ messages in thread
From: YaRu Wei(魏亚茹) @ 2020-11-05  1:06 UTC (permalink / raw)
  To: Richard Earnshaw, gcc

Thanks.

________________________________
发件人: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
发送时间: 2020年11月4日 23:45:39
收件人: YaRu Wei(魏亚茹); gcc@gcc.gnu.org
主题: Re: Disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc.

On 30/10/2020 08:53, YaRu Wei(魏亚茹) wrote:
> Dear gcc:
> I find that disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc. I want to know under what circumstances malloc will be optimized to calloc?
> Thanks
>

I would presume this would happen if the call to malloc were immediately
followed by a call to memset to clear the memory (or an equivalent
software coded implementation of memset were detected).  Generally,
calloc has a better idea of the memory being allocated and can optimize
the clearing step if it knows the memory is already zeroed.

R.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-05  1:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  8:53 Disassemble the .lib file compiled with gcc-arm-8.3-2019.03-x86_64-arm-eabi compilation tool chain, and found that malloc is optimized to calloc YaRu Wei(魏亚茹)
2020-11-04 15:45 ` Richard Earnshaw
2020-11-05  1:06   ` 答复: " YaRu Wei(魏亚茹)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).