https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60818
--- Comment #24 from Segher Boessenkool <segher at gcc dot gnu.org> --- Author: segher Date: Tue Apr 4 00:10:02 2017 New Revision: 246666 URL: https://gcc.gnu.org/viewcvs?rev=246666&root=gcc&view=rev Log: simplify-rtx: Fix compare of comparisons (PR60818) The function simplify_binary_operation_1 has code that does /* Convert (compare (gt (flags) 0) (lt (flags) 0)) to (flags). */ but this transformation is only valid if "flags" has the same machine mode as the outer compare. This fixes it. PR rtl-optimization/60818 * simplify-rtx.c (simplify_binary_operation_1): Do not replace a compare of comparisons with the thing compared if this results in a different machine mode. gcc/testsuite/ PR rtl-optimization/60818 * gcc.c-torture/compile/pr60818.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr60818.c Modified: trunk/gcc/ChangeLog trunk/gcc/simplify-rtx.c trunk/gcc/testsuite/ChangeLog