Re: [PATCH] c++: Avoid incorrect shortening of divisions [PR108365]

2023-01-12 Thread Jakub Jelinek via Gcc-patches
On Thu, Jan 12, 2023 at 02:37:13PM -0500, Jason Merrill wrote: > > But the C++ FE was checking if op0 is a NOP_EXPR from TYPE_UNSIGNED. > > First of all, not sure if the operand of NOP_EXPR couldn't be non-integral > > type where TYPE_UNSIGNED wouldn't be meaningful, but more importantly, > > even

Re: [PATCH] c++: Avoid incorrect shortening of divisions [PR108365]

2023-01-12 Thread Jason Merrill via Gcc-patches
On 1/11/23 12:58, Jakub Jelinek wrote: Hi! The following testcase is miscompiled, because we shorten the division in a case where it should not be shortened. Divisions (and modulos) can be shortened if it is unsigned division/modulo, or if it is signed division/modulo where we can prove the divi

[PATCH] c++: Avoid incorrect shortening of divisions [PR108365]

2023-01-11 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase is miscompiled, because we shorten the division in a case where it should not be shortened. Divisions (and modulos) can be shortened if it is unsigned division/modulo, or if it is signed division/modulo where we can prove the dividend will not be the minimum signed value