OSDN Git Service

PR rtl-optimization/52139
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / sra-5.c
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
3
4 /* Tests for SRA of unions. */
5
6
7 typedef union testunion
8 {
9   double d;
10   char f1;
11 } testunion;
12
13 void
14 copyunion1 (testunion param)
15 {
16   testunion local;
17   param.f1 = 0;
18   local = param;
19   if (local.f1 != 0)
20     link_error ();
21 }
22
23 void
24 copyunion11 (testunion *param)
25 {
26   testunion local;
27   param->f1 = 0;
28   local = *param;
29   if (local.f1 != 0)
30     link_error ();
31 }
32
33 void
34 copyunion111 (testunion param)
35 {
36   testunion *local = &param;
37   param.f1 = 0;
38   if (local->f1 != 0)
39     link_error ();
40 }
41
42 testunion globuf;
43 void
44 copyunion1111 (void)
45 {
46   testunion local;
47   globuf.f1 = 0;
48   local = globuf;
49   if (local.f1 != 0)
50     link_error ();
51 }
52
53 void
54 copyunion11111 (void)
55 {
56   testunion *local = &globuf;
57   globuf.f1 = 0;
58   if (local->f1 != 0)
59     link_error ();
60 }
61
62 void
63 copyunion111111 (testunion param)
64 {
65   static testunion local;
66   param.f1 = 0;
67   local = param;
68   if (local.f1 != 0)
69     link_error ();
70 }
71
72 /* There should be no reference to link_error. */
73 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
74 /* { dg-final { cleanup-tree-dump "optimized" } } */