1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
3 
4 /* Tests for SRA. */
5 
6 void link_error (void);
7 
8 typedef struct teststruct
9 {
10   double d;
11   char f1;
12 } teststruct;
13 
14 void
copystruct1(teststruct param)15 copystruct1 (teststruct param)
16 {
17   teststruct local;
18   param.f1 = 0;
19   local = param;
20   if (local.f1 != 0)
21     link_error ();
22 }
23 
24 void
copystruct11(teststruct * param)25 copystruct11 (teststruct *param)
26 {
27   teststruct local;
28   param->f1 = 0;
29   local = *param;
30   if (local.f1 != 0)
31     link_error ();
32 }
33 
34 void
copystruct111(teststruct param)35 copystruct111 (teststruct param)
36 {
37   teststruct *local = &param;
38   param.f1 = 0;
39   if (local->f1 != 0)
40     link_error ();
41 }
42 
43 teststruct globf;
44 void
copystruct1111(void)45 copystruct1111 (void)
46 {
47   teststruct local;
48   globf.f1 = 0;
49   local = globf;
50   if (local.f1 != 0)
51     link_error ();
52 }
53 
54 void
copystruct11111(void)55 copystruct11111 (void)
56 {
57   teststruct *local = &globf;
58   globf.f1 = 0;
59   if (local->f1 != 0)
60     link_error ();
61 }
62 
63 void
copystruct111111(teststruct param)64 copystruct111111 (teststruct param)
65 {
66   static teststruct local;
67   param.f1 = 0;
68   local = param;
69   if (local.f1 != 0)
70     link_error ();
71 }
72 
73 /* There should be no referenc to link_error. */
74 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
75