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

--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
I tried this code:

extern void g( int);

void f( int mant, int sticky)
{
        mant = mant >> 1 ;
        mant = mant >> 1 | (mant & 1);
        mant = mant >> 1 | (mant & 1) | !!sticky;
        mant = !!sticky;
        mant = (mant & 1) | !!sticky;
        g( mant);
}

Cppcheck says:

$ ~/cppcheck/trunk/cppcheck --enable=all apr12a.cc
apr12a.cc:8:32: style: Boolean result is used in bitwise operation. Clarify
expression with parentheses. [clarifyCondition]
 mant = mant >> 1 | (mant & 1) | !!sticky;
                               ^
apr12a.cc:10:20: style: Boolean result is used in bitwise operation. Clarify
expression with parentheses. [clarifyCondition]
 mant = (mant & 1) | !!sticky;
                   ^
so it appears to be the combination of bitwise operation (mant & 1) 
and the boolean result !!sticky.

Reply via email to