http://llvm.org/bugs/show_bug.cgi?id=3333
Summary: No warning when shifting invalid amount
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
When using operators ">>" or "<<", the valid range for the shift amount is [0,
# bits in type).
GCC gives appropriate warnings when the shift amount is an out-of-range
constant, such as:
"warning: right shift count is negative"
and
"warning: left shift count >= width of type"
However, clang does not present any warnings on the same code. An example
input:
#include <stdio.h>
int main(void)
{
int i = 1;
printf("%d\n", i>>-1);
return 0;
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs