blob: 6965b8c737fbaf4396a716ef960ab2232794bcb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// PR c++/27768
// Alias grouping was losing some may_aliases, causing us to think
// the store to w.p was dead.
// { dg-do run }
// { dg-options "-O2" }
int N = 1;
struct VA
{
int *p, *q, *r;
VA() : p(), q() {}
VA(const VA&) : p(), q() {}
~VA() { if (p) --N; }
};
inline void foo(VA, VA, VA) {}
struct VB
{
VA va;
VB() {}
VB(const VB&)
{
va.p = new int(va.q - va.p);
va.r = va.p + (va.q - va.p);
foo(va, va, va);
}
};
struct VC : VB { char c; };
struct V : VC {};
struct WA
{
struct X {};
X **p, **q, **r;
WA() : p() {}
~WA() { if (p) --N; }
};
struct W : WA {};
int main()
{
{
V v, u(v);
W w;
}
return N;
}
|