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 c/81484] incorrect -Wint-in-bool-context warning


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
a) and b) are the same.  I don't think c) is necessarily wrong code, but the
warning doesn't warn (and it shouldn't), so let's put that aside.  So this
boils down to

void
foo (int c)
{
  if (c ? 0 : 2)
    __builtin_abort ();
}

w.c: In function ‘foo’:
w.c:4:13: warning: ?: using integer constants in boolean context
[-Wint-in-bool-context]
   if (c ? 0 : 2)
       ~~~~~~^~~

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