[Bug middle-end/81320] -Wlogical-op diagnostic depends on comparison' order
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 11 13:27:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81320
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-07-11
Ever confirmed|0 |1
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We fail to warn in f2 because we compare the expression in the conditional
sequentially, but that doesn't work due to left-to-right associativity: we
compare
i == 0 with i == 1
and then
i == 0 || i == 1 with i == 0.
The fix would probably be to keep [low, high] pairs for every comparison and
then compare the pairs.
More information about the Gcc-bugs
mailing list