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