1 /* { dg-do link } */
2 /* { dg-options "-O -fdump-tree-fre1-details" } */
3
4 void link_error (void);
5
test1(int * p,int * q)6 void test1 (int *p, int *q)
7 {
8 *p = 1;
9 *q = 1;
10 if (*p != 1)
11 link_error ();
12 }
13
test2(int * p,int * q,int t)14 void test2 (int *p, int *q, int t)
15 {
16 *p = t;
17 *q = t;
18 if (*p != t)
19 link_error ();
20 }
21
test3(int * q,int * p)22 void test3 (int *q, int *p)
23 {
24 int tem = *p;
25 *q = tem;
26 if (*p != tem)
27 link_error ();
28 }
29
30 char a[4];
31 struct A { char a[4]; };
test4(struct A * p)32 void test4 (struct A *p)
33 {
34 a[0] = p->a[0];
35 a[0] = p->a[0];
36 a[0] = p->a[0];
37 }
38
main()39 int main() { return 0; }
40
41 /* { dg-final { scan-tree-dump-times "Replaced \\\*p" 3 "fre1" } } */
42 /* { dg-final { scan-tree-dump-times "Replaced p_.\\(D\\)->" 2 "fre1" } } */
43 /* { dg-final { scan-tree-dump-times "Deleted redundant store a\\\[0\\\]" 2 "fre1" } } */
44