On Mittwoch, 4. Dezember 2019 03:39:56 CET Thorsten Otto wrote:
> The clang compiler used there also spits out several warnings
Some of these warnings look like there is really something wrong there:
/home/sebilla/atari/hatari/src/cpu/softfloat/softfloat.c:181:22: warning: bitwise negation of a boolean _expression_; did you mean logical negation? [-Wbool-operation] zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & ( status->float_rounding_mode == float_round_nearest_even ) ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! /home/sebilla/atari/hatari/src/cpu/softfloat/softfloat.c:300:22: warning: bitwise negation of a boolean _expression_; did you mean logical negation? [-Wbool-operation] zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & ( floatx80_internal_mode == float_round_nearest_even ) ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! [ 57%] Building C object src/cpu/CMakeFiles/UaeCpu.dir/softfloat/softfloat_decimal.c.o 2 warnings generated. [ 58%] Building C object src/cpu/CMakeFiles/UaeCpu.dir/softfloat/softfloat_fpsp.c.o /home/sebilla/atari/hatari/src/cpu/softfloat/softfloat_decimal.c:58:13: warning: bitwise negation of a boolean _expression_; did you mean logical negation? [-Wbool-operation] zSig0 &= ~ (((uint64_t) (zSig1<<1) == 0) & (status->float_rounding_mode == float_round_nearest_even)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !
Remember that gcc in c99 mode implements a real bool type like in C++, and ~((bool)0) will result in 1, not a bitmask of all ones like seems to be intended by above code. Even without c99, the type of the _expression_ will be int, and ~(0) will result in 0xffffffff, not (uint64_t)-1
|