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))

Reply via email to