https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95924
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- * If I replace ~a with !a, we manage to do everything with type bool. With ~a, we don't, we stick to int. * We don't handle a?b:false the same as a&&b. * Even for (a | !b) && (!(!a & b) && a) we don't completely simplify, because that would be replacing too many && with & (I think). If I manually replace one && with &, gcc manages.