https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64338
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 34393 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34393&action=edit gcc5-pr64338.patch ix86_expand_int_movcc is called there with (ltgt (reg:CCFPU flags) (const_int 0)) condition, and I see several issues with that: 1) the code assumes that reverse_condition (whatever kind of that) always succeeds, which is not always true; we shouldn't swap things if we can't reverse condition 2) for CCFP/CCFPU modes, we should treat them like floating point modes, LTGT is reversible 3) in the first hunk, there are dead assignments: compare_code = reverse_condition_maybe_unordered (compare_code); and compare_code = reverse_condition (compare_code); when only a few lines below that there is unconditional: compare_code = UNKNOWN; 4) (not handled in the patch), diff uses HOST_WIDE_INT variable, signed, and the values can be arbitrary, so we can end up with undefined behavior in the compiler if cf - ct overflows, or if diff is HWI minimum on diff = -diff etc.