Re: [PATCH] tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

2021-10-11 Thread Michael Matz via Gcc-patches
Hello, On Sat, 9 Oct 2021, apinski--- via Gcc-patches wrote: > + (lshift (convert (convert:boolean_type_node @0)) { shift; }))) > +/* a ? -1 : 0 -> -a. No need to check the TYPE_PRECISION not being 1 > + here as the powerof2cst case above will handle that case correctly. > */

Re: [PATCH] tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

2021-10-10 Thread Richard Biener via Gcc-patches
On October 10, 2021 7:42:19 AM GMT+02:00, apinski--- via Gcc-patches wrote: >From: Andrew Pinski > >So it turns out this is kinda of a latent bug but not really latent. >In GCC 9 and 10, phi-opt would transform a?-1:0 (even for signed 1-bit integer) >to -(type)a but the type is an one bit

[PATCH] tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

2021-10-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski So it turns out this is kinda of a latent bug but not really latent. In GCC 9 and 10, phi-opt would transform a?-1:0 (even for signed 1-bit integer) to -(type)a but the type is an one bit integer which means the negation is undefined. GCC 11 fixed the problem by checking for