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

2020-10-28 Thread Christophe Lyon via Gcc-patches
Hi, On Mon, 26 Oct 2020 at 13:44, Richard Sandiford via Gcc-patches wrote: > > Tamar Christina writes: > > Hi Richard, > > > > The 10/26/2020 11:29, Richard Sandiford wrote: > >> Tamar Christina writes: > >> >/* We can't do anything smart if the amount to copy is not constant. > >> > */ >

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

2020-10-26 Thread Richard Sandiford via Gcc-patches
Tamar Christina writes: > Hi Richard, > > The 10/26/2020 11:29, Richard Sandiford wrote: >> Tamar Christina 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

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

2020-10-26 Thread Tamar Christina via Gcc-patches
Hi Richard, The 10/26/2020 11:29, Richard Sandiford wrote: > Tamar Christina 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

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

2020-10-26 Thread Richard Sandiford via Gcc-patches
Tamar Christina 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 li

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

2020-10-23 Thread Tamar Christina via Gcc-patches
Hi All, Currently the inline memcpy expansion code for AArch64 is using a signed int to hold the number of elements to copy. When you giver give it a value larger than INT_MAX it will overflow. The overflow causes the maximum number of instructions we want to expand to check to fail since this a