Debian Codegraph @

gcc/testsuite/gcc.dg/sso/s6.c

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