[PATCH]AArch64 Fix overflow in memcopy expansion on aarch64.

Richard Sandiford richard.sandiford@arm.com
Mon Oct 26 12:44:22 GMT 2020


Tamar Christina <Tamar.Christina@arm.com> writes:
> Hi Richard,
>
> The 10/26/2020 11:29, Richard Sandiford wrote:
>> Tamar Christina <tamar.christina@arm.com> writes:
>> >    /* We can't do anything smart if the amount to copy is not constant.  */
>> >    if (!CONST_INT_P (operands[2]))
>> >      return false;
>> > 
>> > -  n = INTVAL (operands[2]);
>> > +  /* This may get truncated but that's fine as it would be above our maximum
>> > +     memset inline limit.  */
>> > +  unsigned tmp = INTVAL (operands[2]);
>> 
>> That's not true for (1ULL << 32) + 1 for example, since the truncated
>> value will come under the limit.  I think we should just do:
>> 
>>   unsigned HOST_WIDE_INT tmp = UINTVAL (operands[2]);
>> 
>> without a comment.
>> 
>
> Updated patch attached.
>
> Ok for master and GCC 8, 9, 10?

OK, thanks.

Richard


More information about the Gcc-patches mailing list