[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Analysis / invalid-deref.c
blob05cb2ed2cdcb303e8a4ab9424f1967b190356a8f
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
3 typedef unsigned uintptr_t;
5 void f1(void) {
6 int *p;
7 *p = 0; // expected-warning{{Dereference of undefined pointer value}}
10 struct foo_struct {
11 int x;
14 int f2(void) {
15 struct foo_struct *p;
17 return p->x++; // expected-warning{{Access to field 'x' results in a dereference of an undefined pointer value (loaded from variable 'p')}}
20 int f3(void) {
21 char *x;
22 int i = 2;
24 return x[i + 1]; // expected-warning{{Array access (from variable 'x') results in an undefined pointer dereference}}
27 int f3_b(void) {
28 char *x;
29 int i = 2;
31 return x[i + 1]++; // expected-warning{{Array access (from variable 'x') results in an undefined pointer dereference}}