1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-gimple" } */
3
4 struct f
5 {
6 int i;
7 int j;
8 };
9
10 struct g
11 {
12 int i;
13 struct f j;
14 struct f *k;
15 };
16
foo(struct f * x,struct f * y)17 int foo(struct f *x, struct f *y)
18 {
19 return &x->j == &y->j; /* x == y */
20 }
21
22 struct f y;
bar(struct f * x)23 int bar(struct f *x)
24 {
25 return &x->j == &y.j; /* x == &y */
26 }
27
28 struct g yy;
foobar(struct g * x)29 int foobar(struct g *x)
30 {
31 return &x->j.i == &yy.j.i; /* x == &yy */
32 }
foobar2(struct g * x)33 int foobar2(struct g *x)
34 {
35 return &x->k->i == &yy.k->i; /* x->k == yy.k */
36 }
37
38 /* { dg-final { scan-tree-dump-times "x == y" 1 "gimple" } } */
39 /* { dg-final { scan-tree-dump-times "x == &y" 2 "gimple" } } */
40 /* { dg-final { scan-tree-dump "x->k" "gimple" } } */
41 /* { dg-final { scan-tree-dump "yy.k" "gimple" } } */
42