[LLVMbugs] [Bug 23211] New: clang doesn't warn when integer is tried against literal that is too big
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Apr 13 02:57:37 PDT 2015
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: unassignedclangbugs at nondot.org
Reporter: nchambers at dtscode.io
CC: llvmbugs at cs.uiuc.edu
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 at dtscode-laptop:~/Desktop$ clang unsigned-test.c -o unsigned-test -Wall
-Wextra -pedantic -Wtype-limits
dtscode at dtscode-laptop:~/Desktop$
using similar flags in gcc (with the addition of -std=c99 since I'm a few
releases behind):
dtscode at 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 at dtscode-laptop:~/Desktop$
--
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/20150413/7bd46334/attachment.html>
More information about the llvm-bugs
mailing list