Re: [PATCH v2] cse: avoid signed overflow in compute_const_anchors [PR 104843]

2022-03-11 Thread Richard Biener via Gcc-patches
On Thu, Mar 10, 2022 at 12:32 PM Xi Ruoyao wrote: > > On Thu, 2022-03-10 at 09:01 +0100, Richard Biener wrote: > > On Wed, Mar 9, 2022 at 5:12 PM Xi Ruoyao > > wrote: > > > > > > On Wed, 2022-03-09 at 15:55 +0100, Richard Biener wrote: > > > > > > > isn't it better to make targetm.const_anchor un

Re: [PATCH v2] cse: avoid signed overflow in compute_const_anchors [PR 104843]

2022-03-10 Thread Xi Ruoyao via Gcc-patches
On Thu, 2022-03-10 at 09:01 +0100, Richard Biener wrote: > On Wed, Mar 9, 2022 at 5:12 PM Xi Ruoyao > wrote: > > > > On Wed, 2022-03-09 at 15:55 +0100, Richard Biener wrote: > > > > > isn't it better to make targetm.const_anchor unsigned? > > > The & and ~ are not subject to overflow rules. > >

Re: [PATCH v2] cse: avoid signed overflow in compute_const_anchors [PR 104843]

2022-03-10 Thread Richard Biener via Gcc-patches
On Wed, Mar 9, 2022 at 5:12 PM Xi Ruoyao wrote: > > On Wed, 2022-03-09 at 15:55 +0100, Richard Biener wrote: > > > isn't it better to make targetm.const_anchor unsigned? > > The & and ~ are not subject to overflow rules. > > It's not enough: if n is the minimum value of HOST_WIDE_INT and > const_a

[PATCH v2] cse: avoid signed overflow in compute_const_anchors [PR 104843]

2022-03-09 Thread Xi Ruoyao via Gcc-patches
On Wed, 2022-03-09 at 15:55 +0100, Richard Biener wrote: > isn't it better to make targetm.const_anchor unsigned? > The & and ~ are not subject to overflow rules. It's not enough: if n is the minimum value of HOST_WIDE_INT and const_anchor = 0x8000 (the value for MIPS), we'll have a signed 0x7fff