Add more tests testing derefs in BinOps and Casts.
This commit is contained in:
parent
e9376dd7a6
commit
fc98551c43
10
test/NullDeref/BinOp.C
Normal file
10
test/NullDeref/BinOp.C
Normal file
@ -0,0 +1,10 @@
|
||||
// RUN: cat %s | %cling -Xclang -verify
|
||||
//This file checks a pointer load operation for null prt dereference.
|
||||
// XFAIL: i686-pc-linux-gnu
|
||||
int *p = 0;
|
||||
int x;
|
||||
x = *p + 2; // expected-warning {{null passed to a callee which requires a non-null argument}}
|
||||
x = 2 + *p; // expected-warning {{null passed to a callee which requires a non-null argument}}
|
||||
|
||||
x = *p > 2; // expected-warning {{null passed to a callee which requires a non-null argument}}
|
||||
x = 2 > *p; // expected-warning {{null passed to a callee which requires a non-null argument}}
|
10
test/NullDeref/Cast.C
Normal file
10
test/NullDeref/Cast.C
Normal file
@ -0,0 +1,10 @@
|
||||
// RUN: cat %s | %cling -Xclang -verify
|
||||
//This file checks a pointer load operation for null prt dereference.
|
||||
// XFAIL: i686-pc-linux-gnu
|
||||
int *p = 0;;
|
||||
double x;
|
||||
x = double(*p); // expected-warning {{null passed to a callee which requires a non-null argument}}
|
||||
|
||||
void *q = 0;
|
||||
int y;
|
||||
y = int(*(int *)q); // expected-warning {{null passed to a callee which requires a non-null argument}}
|
Loading…
x
Reference in New Issue
Block a user