https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87900
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The question now comes should this be handled too:
```
typedef int type;
#define size (4)
type *foo ()
{
type *p = (type *)__builtin_malloc (size*sizeof(type));
type tmp[size] = {};
__builtin_memcpy(p,tmp,sizeof(tmp));
return p;
}
```
MY patch does not handle this because we get:
```
p_3 = __builtin_malloc (16);
MEM <uint128_t> [(char * {ref-all})p_3] = 0;
```
I am thinking that is ok here.
What is interesting is that change the type to char and then do a non-power of
2, clang will transform it into calloc (my patch too) but if you have a power
of 2 up to 8, clang will not do the transformation (at least for aarch64).
I am not 100% sure if we want to have a lower limit for the size of memset
either. clang acts similar enough to my patch though.