http://llvm.org/bugs/show_bug.cgi?id=15535
Bug ID: 15535
Summary: warn on (sometimes?) dereference of one-past-end
pointer
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
I'd like something like -Wuninitialized/-Wsometimes-uninitialized but which
keeps track of pointers that are known to point to one-past-the-end of an
array, and warn when dereferenced.
For motivation, see the example code in bug 15522 which clang issues no
warnings for. If the program instead asked for "long *pk = &buf[3];" clang
would issue a warning with -Warray-bounds because that's two past the end of
the array and consequently always invalid.
char buf[2];
char *p = &buf[2];
*p = '\0'; // please warn here.
Also, using the same logic from the -Wsometimes-uninitialized flag, I'd also
like this:
char buf[2];
char *p = &buf[2];
if (condition) {
*p = '\0'; // please warn in here as well.
}
--
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