blob: 68dd4c693975047063776dc4486144c4feee9cfe (
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
|
// PR tree-optimization/42508
// { dg-do run }
// { dg-options "-O1 -fipa-sra" }
extern "C" void abort ();
int v[10], vidx;
struct A
{
A *prev;
int i;
~A()
{
v[vidx++] = i;
delete prev;
}
};
int
main ()
{
A *a1 = new A ();
A *a2 = new A ();
a1->prev = 0;
a1->i = 1;
a2->prev = a1;
a2->i = 2;
delete a2;
if (vidx != 2 || v[0] != 2 || v[1] != 1)
abort ();
return 0;
}
|