1 /* { dg-do run } */
2
3 #include <stdio.h>
4
5 #include "init8.h"
6 #include "dump.h"
7
main(void)8 int main (void)
9 {
10 struct R1 A1 = My_R1;
11 struct R2 A2 = My_R2;
12
13 struct Nested1 N1;
14 struct Nested2 N2;
15
16 int C1;
17 int C2;
18 int C3;
19
20 put ("A1 :");
21 dump (&A1, sizeof (struct R1));
22 new_line ();
23 /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" } */
24
25 put ("A2 :");
26 dump (&A2, sizeof (struct R2));
27 new_line ();
28 /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" } */
29
30 N1 = A1.N;
31 C1 = N1.C1;
32 C2 = N1.C2;
33 C3 = N1.C3;
34
35 printf ("C1 : %d\n", C1);
36 /* { dg-output "C1 : 11206674.*\n" } */
37
38 printf ("C2 : %d\n", C2);
39 /* { dg-output "C2 : 13434932.*\n" } */
40
41 printf ("C3 : %d\n", C3);
42 /* { dg-output "C3 : 15663190.*\n" } */
43
44 N1.C1 = C1;
45 N1.C2 = C2;
46 N1.C3 = C3;
47 A1.N = N1;
48
49 N2 = A2.N;
50 C1 = N2.C1;
51 C2 = N2.C2;
52 C3 = N2.C3;
53
54 printf ("C1 : %d\n", C1);
55 /* { dg-output "C1 : 11206674.*\n" } */
56
57 printf ("C2 : %d\n", C2);
58 /* { dg-output "C2 : 13434932.*\n" } */
59
60 printf ("C3 : %d\n", C3);
61 /* { dg-output "C3 : 15663190.*\n" } */
62
63 N2.C1 = C1;
64 N2.C2 = C2;
65 N2.C3 = C3;
66 A2.N = N2;
67
68 put ("A1 :");
69 dump (&A1, sizeof (struct R1));
70 new_line ();
71 /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" } */
72
73 put ("A2 :");
74 dump (&A2, sizeof (struct R2));
75 new_line ();
76 /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" } */
77
78 new_line ();
79 return 0;
80 }
81