[LLVMbugs] [Bug 18625] New: No -Wsign-conversion warning for compound assignment statement
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jan 27 00:32:57 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18625
Bug ID: 18625
Summary: No -Wsign-conversion warning for compound assignment
statement
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: chengniansun at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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*/
^
$:
--
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/20140127/a3fcf7cc/attachment.html>
More information about the llvm-bugs
mailing list