This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/82062] New: [8 regression] simple conditional expressions no longer folded


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82062

            Bug ID: 82062
           Summary: [8 regression] simple conditional expressions no
                    longer folded
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ebotcazou at gcc dot gnu.org
  Target Milestone: ---

The patch

2017-08-17  Marek Polacek  <polacek@redhat.com>

        PR middle-end/81814
        * fold-const.c (operand_equal_for_comparison_p): Remove code that used
        to mimic what shorten_compare did.  Change the return type to bool.
        (fold_cond_expr_with_comparison): Update call to
        operand_equal_for_comparison_p.
        (fold_ternary_loc): Likewise.

has introduced regressions in the folding of simple conditional expressions,
which happens quite a lot in Ada.  Trivial examples for 64-bit targets:

unsigned long foo (int x)
{
  return x > 0 ? (unsigned long) x : 0;
}

unsigned long bar (int x, int y)
{
  return x > y ? (unsigned long) x : (unsigned long) y;
}

The COND_EXPRs are no longer folded into MAX_EXPRs.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]