mirror of
https://github.com/intel/llvm.git
synced 2026-02-08 00:50:03 +08:00
Added null dereference test involving arrays.
llvm-svn: 50084
This commit is contained in:
@@ -16,3 +16,14 @@ int f2(struct foo_struct* p) {
|
||||
|
||||
return p->x++; // expected-warning{{Dereference of null pointer.}}
|
||||
}
|
||||
|
||||
int f3(char* x) {
|
||||
|
||||
int i = 2;
|
||||
|
||||
if (x)
|
||||
return x[i - 1];
|
||||
|
||||
return x[i+1]; // expected-warning{{Dereference of null pointer.}}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user