This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/77574] New: Wrong if condition in predict.c
- From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Sep 2016 22:30:29 +0000
- Subject: [Bug middle-end/77574] New: Wrong if condition in predict.c
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77574
Bug ID: 77574
Summary: Wrong if condition in predict.c
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: bernd.edlinger at hotmail dot de
Target Milestone: ---
Hi,
an experimental version of my -Wint-in-bool-context patch
found this apparently wrong code in predict.c
../../gcc-trunk/gcc/predict.c: In function 'void force_edge_cold(edge, bool)':
../../gcc-trunk/gcc/predict.c:3726:36: error: ?: using integer constants in
boolean context [-Werror=int-in-bool-context]
if (e->probability <= impossible ? PROB_VERY_UNLIKELY : 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
&& (!impossible || !e->count))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I think it is meant this way:
if (e->probability <= (impossible ? PROB_VERY_UNLIKELY : 0)
&& (!impossible || !e->count))