http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58088
--- Comment #5 from ktkachov at gcc dot gnu.org --- (In reply to Marek Polacek from comment #4) > Another testcases: > > int > bar (int i) > { > return 1 | ((i * 2) & 254); > } > > int > foo (int i) > { > return 1 | ((i * 2) & 255); > } This happens for any value of the RHS of the AND that is >= 128. A stack overflow occurs because fold_binary_loc keeps getting called, but op1, which is supposed to be the result of maksing the RHS with the NOT of the 2 in (i * 2) is set to something else. Now investigating...