111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
|
|
3
|
|
4 void link_error();
|
|
5
|
|
6 struct OOf {
|
|
7 int value;
|
|
8 OOf() {value = 0;}
|
|
9 };
|
|
10 inline OOf operator+(OOf op1, OOf op2)
|
|
11 {
|
|
12 OOf f;
|
|
13 f.value = op1.value + op2.value;
|
|
14 return f;
|
|
15 }
|
|
16 inline OOf operator*(OOf op1, OOf op2)
|
|
17 {
|
|
18 OOf f;
|
|
19 f.value = op1.value * op2.value;
|
|
20 return f;
|
|
21 }
|
|
22 inline OOf operator-(OOf op1, OOf op2)
|
|
23 {
|
|
24 OOf f;
|
|
25 f.value = op1.value - op2.value;
|
|
26 return f;
|
|
27 }
|
|
28 inline OOf test_func(
|
|
29 OOf a,
|
|
30 OOf b,
|
|
31 OOf c
|
|
32 )
|
|
33 {
|
|
34 OOf d, e;
|
|
35 OOf result;
|
|
36 d = a * b + b * c;
|
|
37 e = a * c - b * d;
|
|
38 result = d * e;
|
|
39 return result;
|
|
40 }
|
|
41
|
|
42 void test()
|
|
43 {
|
|
44 OOf a, b, c;
|
|
45 OOf d = test_func (a,b,c);
|
|
46 if (d.value)
|
|
47 link_error();
|
|
48 }
|
|
49
|
|
50 /* We should have removed the casts from pointers to references and caused SRA to happen. */
|
|
51 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
|