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++/66329] If condition evaluated wrongly for "y&1 == 0" condition


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

Mikhail Maltsev <miyuki at gcc dot gnu.org> changed:

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

--- Comment #4 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
Clang is more verbose:

./test.c:4:11: warning: & has lower precedence than ==; == will be evaluated
first [-Wparentheses]
    x = y & 1 == 1;
          ^~~~~~~~
./test.c:4:11: note: place parentheses around the '==' expression to silence
this warning
    x = y & 1 == 1;
          ^
            (     )
./test.c:4:11: note: place parentheses around the & expression to evaluate it
first
    x = y & 1 == 1;
          ^
        (    )


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