15 lines
550 B
C++
Raw Normal View History

// RUN: cat %s | %cling -Xclang -verify
2013-07-21 16:10:53 +03:00
//This file checks a pointer load operation for null prt dereference.
int *p;
int x;
x = *p; // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
extern "C" int printf(const char* fmt, ...);
class MyClass {
public:
int a;
};
MyClass *m = 0;
if (m->a) { printf("MyClass's a=%d", m->a);} // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
.q