http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58564
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Component|c |middle-end Target Milestone|--- |4.7.4 Summary|possible wrong code bug at |[4.7/4.8/4.9 Regression] |-O0 |possible wrong code bug at | |-O0 --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the bug is in the /* A < 0 ? <sign bit of A> : 0 is simply (A & <sign bit of A>). */ if (TREE_CODE (arg0) == LT_EXPR && integer_zerop (TREE_OPERAND (arg0, 1)) && integer_zerop (op2) && (tem = sign_bit_p (TREE_OPERAND (arg0, 0), arg1))) ... transformation in fold_ternary_loc or sign_bit_p or combination thereof. We get here with arg0 ((int) (d == &c && a != 1)) < 0, arg1 1U and arg2 0U, sign_bit_p (surprisingly) looks through zero extensions (of bool to int) and returns (d == &c && a != 1) and we incorrectly fold it as (d == &c && a != 1) & 1.