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/77574] Wrong if condition in predict.c


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

--- Comment #1 from Martin Liška <mliska at suse dot cz> ---
On 09/13/2016 12:30 AM, bernd.edlinger at hotmail dot de wrote:
> 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))
> 

Hello Bernd.

Thanks for the PR, as well the suggested patch. The patch works for me,
I'm going to test it and submit to mailing list. Please ping me if you're
accidentally doing the same?

Thanks,
Martin

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