[Bug c/81484] incorrect -Wint-in-bool-context warning
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 19 12:47:00 GMT 2017
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)
~~~~~~^~~
More information about the Gcc-bugs
mailing list