<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="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."
href="http://llvm.org/bugs/show_bug.cgi?id=16433">16433</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>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.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>c.royqin@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>#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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>