[LLVMbugs] [Bug 12659] New: clangs fails to warn integer overflow in expression
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Apr 25 15:48:07 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12659
Bug #: 12659
Summary: clangs fails to warn integer overflow in expression
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: weimingz at codeaurora.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8451
--> http://llvm.org/bugs/attachment.cgi?id=8451
test case
clang version 3.1 (branches/release_31 154941)
For the following code, Clang accepts it without warning:
#include <limits.h>
int foo(int i)
{
switch (i)
{
case INT_MAX + 2: /* error - constant is too large */
return 1;
case (INT_MAX*4)/4: /* error - constant is too large */
return 2;
default:
return 0;
}
return 0;
}
with "-std=c99 -pedantic", no warnings either.
GCC will warn:
constant_ov.c: In function 'foo':
constant_ov.c:6: warning: integer overflow in expression
constant_ov.c:9: warning: integer overflow in expression
--
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.
More information about the llvm-bugs
mailing list