https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81019
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-11-27 CC| |aoliva at gcc dot gnu.org, | |segher at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- /* PR rtl-optimization/81019 */ /* { dg-do run } */ /* { dg-options "-O -fno-tree-ccp" } */ unsigned long long __attribute__((noinline, noclone)) foo (unsigned char a, unsigned short b, unsigned c, unsigned long long d, unsigned char e, unsigned short f, unsigned g, unsigned long long h) { g = e; c &= 0 < d; b *= d; g ^= -1; g &= 1; c |= 1; a -= 0 < g; g >>= 1; f = b | (f >> b); return a + c + d + f + g + h; } int main (void) { if (foo (0, 0, 0, 0, 0, 0, 0, 0) != 0x100) __builtin_abort (); return 0; } This is indeed miscompiled in the combiner if the r249850 change is reverted (which changes costs and thus combiner decides to try different optimizations). With the change reverted, the g &= 1 masking is lost. Alex/Segher, what is the current state of the patch? I see https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00363.html as the last mail on the subject.