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