https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63770
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- from a match.pd pattern /* Try to fold (type) X op CST -> (type) (X op ((type-x) CST)) when profitable. For bitwise binary operations apply operand conversions to the binary operation result instead of to the operands. This allows to combine successive conversions and bitwise binary operations. We combine the above two cases by using a conditional convert. */ (<unnamed-signed:9>) b.f0 & 1 -> (<unnamed-signed:9>) (b.f0 & 1) then from fold_unary 7825 /* Convert (T)(x & c) into (T)x & (T)c, if c is an integer 7826 constants (if x has signed type, the sign bit cannot be set 7827 in c). This folds extension into the BIT_AND_EXPR. ... The existing measure against this recursion doesn't apply. I have a fix.