[Bug c++/26729] bogus 'comparison is always 0' message

apl at alum dot mit dot edu gcc-bugzilla@gcc.gnu.org
Tue Mar 28 21:28:00 GMT 2006



------- Comment #10 from apl at alum dot mit dot edu  2006-03-28 21:28 -------
No, you misread the parentheses.  I've removed all the EXCESS ONES, leaving


  answer = (UInt16(word & 0x3700) == UInt16(0x3000))
              & (UInt16(word & 0x8800) == UInt16(0x8000));

Showing that we're testing disjoint bits within word , e.g.

               word & 0x3700 == 0x3000
         and   word & 0x8800 == 0x8000

which is NOT always zero....

I've added a simplified test case that still shows the problem and contains a
near minimal number of parentheses....


-- 

apl at alum dot mit dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26729



More information about the Gcc-bugs mailing list