1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
2
3 // rdar://problem/64202361
4
5 struct A {
6 int a;
7 struct {
8 struct {
9 int b;
10 union {
11 int c;
12 };
13 };
14 };
15 };
16
testCrash()17 int testCrash() {
18 int *x = 0;
19 int A::*ap = &A::a;
20
21 if (ap) // no crash
22 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
23
24 return 10;
25 }
26
testIndirectCrash()27 int testIndirectCrash() {
28 int *x = 0;
29 int A::*cp = &A::c;
30
31 if (cp) // no crash
32 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
33
34 return 10;
35 }
36