calloc = malloc + memset

Bernd Schmidt bernds_cb1@t-online.de
Tue Jul 15 12:38:00 GMT 2014


On 02/28/2014 11:48 PM, Marc Glisse wrote:
> /* Optimize
> +   ptr = malloc (n);
> +   memset (ptr, 0, n);
> +   into
> +   ptr = calloc (n);
> +   gsi_p is known to point to a call to __builtin_memset.  */

Is there anything in here to prevent us making an infinite loop if the 
above pattern occurs in a function called "calloc"?


Bernd



More information about the Gcc-patches mailing list