[LLVMbugs] [Bug 11536] New: Clang incorrect array-bounds warning on strpbrk in GlibC 2.9 header
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Dec 10 17:33:41 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=11536
Bug #: 11536
Summary: Clang incorrect array-bounds warning on strpbrk in
GlibC 2.9 header
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: pdox at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 7710
--> http://llvm.org/bugs/attachment.cgi?id=7710
example code
Compile the attached example.c with Clang. The code was taken from
bits/string2.h in GlibC 2.9. It appears to be correct.
$ clang example.c -Werror
example.c:26:26: error: array index 2 is past the end of the array
(which contains 2 elements) [-Werror,-Warray-bounds]
foo = strpbrk("hello", "l");
~~~~~~~~~~~~~~~~~^~~~
example.c:16:46: note: expanded from macro 'strpbrk'
: ((__a2 = ((__const char *) (accept))[2], __a2 == '\0') \
^ ~
example.c:26:26: error: array index 3 is past the end of the array
(which contains 2 elements) [-Werror,-Warray-bounds]
foo = strpbrk("hello", "l");
~~~~~~~~~~~~~~~~~^~~~
example.c:18:41: note: expanded from macro 'strpbrk'
: (((__const char *) (accept))[3] == '\0' \
^ ~
2 errors generated.
--
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