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


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

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