Re: [PATCH] match.pd: Avoid ICE with shifts [PR97979]

2020-11-26 Thread Jakub Jelinek via Gcc-patches
On Thu, Nov 26, 2020 at 09:21:53AM +, Richard Biener wrote: > Btw, when looking I figured that int_const_binop loses the sign > of arg2 when folding a signed shift by an unsigned shift amount > and thus these out-of-bound shifts get interpreted as signed > by wide_int_binop even though they are

Re: [PATCH] match.pd: Avoid ICE with shifts [PR97979]

2020-11-26 Thread Richard Biener
On Thu, 26 Nov 2020, Jakub Jelinek wrote: > Hi! > > My recent wide_int_binop changes caused ICE on this testcase. > The problem is that for shift where amount has MSB set now fails to optimize > into a constant (IMHO we should treat out of bounds shifts the same later), > but there is a precedent

[PATCH] match.pd: Avoid ICE with shifts [PR97979]

2020-11-26 Thread Jakub Jelinek via Gcc-patches
Hi! My recent wide_int_binop changes caused ICE on this testcase. The problem is that for shift where amount has MSB set now fails to optimize into a constant (IMHO we should treat out of bounds shifts the same later), but there is a precedent for that already - e.g. division by zero fails to opti