This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81814] Incorrect behaviour at -O0 (conditional operator)
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 11 Aug 2017 13:03:38 +0000
- Subject: [Bug tree-optimization/81814] Incorrect behaviour at -O0 (conditional operator)
- Auto-submitted: auto-generated
- References: <bug-81814-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81814
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ugh, I believe fold_cond_expr_with_comparison does Very Bad stuff: it sees
A == 0 ? A : 0 and thinks that it can be optimized to 0, btu it can't, in this
case we have
(signed char) xxx == 0 ? (unsigned long long) xxx : 0
(signed char) xxx is indeed 0 but (unsigned long long) xxx is not.