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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs