[LLVMbugs] [Bug 18328] alpha.core.BoolAssignment doesn't work as expected

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 1 16:05:58 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18328

Jordan Rose <jordan_rose at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jordan_rose at apple.com
         Resolution|---                         |INVALID

--- Comment #1 from Jordan Rose <jordan_rose at apple.com> ---
alpha.core.BoolAssignment was intended to catch unsafe uses of fake boolean
variables, like Boolean or BOOL, which are actually typedef'd to some form of
char. These are dangerous because (BOOL)256 performs a truncation, not a truth
test, and so the value you get is 0 (false). (bool)256, on the other hand, will
actually compare 256 to 0, and correctly record the value 'true'.

You could argue that there should be a warning for any sort of int-to-bool
conversion where the int isn't known a priori to be 1 or 0, but that wasn't
really the motivation for the checker.

Finally, though, alpha checkers aren't considered real shipping products, so
it's not really worth filing bugs on them unless someone is actively working on
them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140102/c6c7bdfe/attachment.html>


More information about the llvm-bugs mailing list