<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 --- - No -Wsign-conversion warning for compound assignment statement"
href="http://llvm.org/bugs/show_bug.cgi?id=18625">18625</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>No -Wsign-conversion warning for compound assignment statement
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chengniansun@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>No sign conversion warning for compound assignment, such as "&="
$: cat no-sign-conversion.c
int f(int l, unsigned a) {
l &= a; /*no warning here*/
l = l & a; /*warning here*/
return l;
}
$: clang-trunk -c -Wsign-conversion no-sign-conversion.c
no-sign-conversion.c:3:9: warning: implicit conversion changes signedness:
'unsigned int' to 'int'
[-Wsign-conversion]
l = l & a; /*warning here*/
~ ~~^~~
no-sign-conversion.c:3:7: warning: implicit conversion changes signedness:
'int' to 'unsigned int'
[-Wsign-conversion]
l = l & a; /*warning here*/
^ ~
2 warnings generated.
$: clang-trunk --version
clang version 3.5 (trunk 199927)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$:
$: gcc-trunk -c -Wsign-conversion no-sign-conversion.c
no-sign-conversion.c: In function ‘f’:
no-sign-conversion.c:2:3: warning: conversion to ‘unsigned int’ from ‘int’ may
change the sign of the result [-Wsign-conversion]
l &= a; /*no warning here*/
^
no-sign-conversion.c:2:5: warning: conversion to ‘int’ from ‘unsigned int’ may
change the sign of the result [-Wsign-conversion]
l &= a; /*no warning here*/
^
no-sign-conversion.c:3:3: warning: conversion to ‘unsigned int’ from ‘int’ may
change the sign of the result [-Wsign-conversion]
l = l & a; /*warning here*/
^
no-sign-conversion.c:3:9: warning: conversion to ‘int’ from ‘unsigned int’ may
change the sign of the result [-Wsign-conversion]
l = l & a; /*warning here*/
^
$:</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>