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