1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
3 
4 extern void link_error (void);
5 
6 /* Check for cprop on fields of the same struct.  */
7 
8 struct s
9 {
10   char d;
11   int a, b;
12   double m;
13 };
14 
15 
foo(struct s * r)16 void foo (struct s*  r)
17 {
18   r->a = 0;
19   r->b = 1;
20   r->a++;
21   r->b++;
22   if (r->a != 1)
23     link_error ();
24   if (r->b != 2)
25     link_error ();
26 }
27 
28 /* There should be no link_error calls.  */
29 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */
30