https://llvm.org/bugs/show_bug.cgi?id=23211
Bug ID: 23211
Summary: clang doesn't warn when integer is tried against
literal that is too big
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 14195
--> https://llvm.org/bugs/attachment.cgi?id=14195&action=edit
Testcase
Using the attached testcase, clang doesn't output any warnings when comparing
an unsigned int against a literal that is too big in size. Compile Flags:
dtscode@dtscode-laptop:~/Desktop$ clang unsigned-test.c -o unsigned-test -Wall
-Wextra -pedantic -Wtype-limits
dtscode@dtscode-laptop:~/Desktop$
using similar flags in gcc (with the addition of -std=c99 since I'm a few
releases behind):
dtscode@dtscode-laptop:~/Desktop$ gcc -std=c99 unsigned-test.c -o unsigned-test
-Wall -Wextra -pedantic
unsigned-test.c: In function ‘main’:
unsigned-test.c:5:3: warning: comparison is always true due to limited range of
data type [-Wtype-limits]
for (unsigned int i=0; i<=4294967295; i++) sum++;
^
dtscode@dtscode-laptop:~/Desktop$
--
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