This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/82062] New: [8 regression] simple conditional expressions no longer folded
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Aug 2017 17:56:30 +0000
- Subject: [Bug middle-end/82062] New: [8 regression] simple conditional expressions no longer folded
- Auto-submitted: auto-generated
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.