[LLVMbugs] [Bug 16433] New: the unary operator shall return a 0 if the value of its operand compares unequal to 0, and -1 (i.e. all bits set) if the value of its operand compares equal to 0.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 24 17:37:13 PDT 2013


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

            Bug ID: 16433
           Summary: the unary operator shall return a 0 if the value of
                    its operand compares unequal to 0, and -1 (i.e. all
                    bits set) if the value of its operand compares equal
                    to 0.
           Product: clang
           Version: 3.3
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: c.royqin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include<stdio.h>
#include <math.h>
typedef char char2 _attribute_((ext_vector_type(2)));
int main(){
char a = 0x0;
char2 b = (char2)
{0,0}
;
printf("%x\n", !a);
printf("%x\n", !b);
}

The result of this code is different between PC and MIPS.
The result is correct in PC , but error in MIPS.
So, it is Clang's bug .

For scalar types, the result of the logical unary operator is 0 if the value of
its operand
compares unequal to 0, and 1 if the value of its operand compares equal to 0.
For vector
types, the unary operator shall return a 0 if the value of its operand compares
unequal to 0,
and -1 (i.e. all bits set) if the value of its operand compares equal to 0.

-- 
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/20130625/1361cd55/attachment.html>


More information about the llvm-bugs mailing list