1 /* PR c/78408 */
2 /* { dg-do compile { target size32plus } } */
3 /* { dg-options "-O2 -fdump-tree-fab1-details" } */
4 /* { dg-final { scan-tree-dump-times "after previous" 17 "fab1" } } */
5 
6 struct S { char a[32]; };
7 struct T { char a[65536]; };
8 void bar (int, struct S *, struct S *, struct T *, struct T *);
9 void baz (char *, char *);
10 
11 void
f1(void)12 f1 (void)
13 {
14   struct S a, b;
15   struct T c, d;
16   a = b = (struct S) {};
17   c = d = (struct T) {};
18   bar (1, &a, &b, &c, &d);
19 }
20 
21 void
f2(void)22 f2 (void)
23 {
24   struct S a, b;
25   struct T c, d;
26   b = (struct S) {};
27   a = b;
28   d = (struct T) {};
29   c = d;
30   bar (2, &a, &b, &c, &d);
31 }
32 
33 void
f3(void)34 f3 (void)
35 {
36   struct S a, b;
37   struct T c, d;
38   __builtin_memset (&b, 0, sizeof (b));
39   a = b;
40   __builtin_memset (&d, 0, sizeof (d));
41   c = d;
42   bar (3, &a, &b, &c, &d);
43 }
44 
45 
46 void
f4(void)47 f4 (void)
48 {
49   struct S a, b;
50   struct T c, d;
51   b = (struct S) {};
52   __builtin_memcpy (&a, &b, sizeof (b));
53   d = (struct T) {};
54   __builtin_memcpy (&c, &d, sizeof (d));
55   bar (4, &a, &b, &c, &d);
56 }
57 
58 void
f5(void)59 f5 (void)
60 {
61   struct S a, b;
62   struct T c, d;
63   __builtin_memset (&b, 0, sizeof (b));
64   __builtin_memcpy (&a, &b, sizeof (b));
65   __builtin_memset (&d, 0, sizeof (d));
66   __builtin_memcpy (&c, &d, sizeof (d));
67   bar (5, &a, &b, &c, &d);
68 }
69 
70 void
f6(void)71 f6 (void)
72 {
73   struct S a, b, e, g;
74   struct T c, d, f, h;
75   g = e = a = b = (struct S) {};
76   h = f = c = d = (struct T) {};
77   bar (6, &a, &b, &c, &d);
78   bar (6, &e, &g, &f, &h);
79 }
80 
81 void
f7(void)82 f7 (void)
83 {
84   char a[64], b[64];
85   __builtin_memset (a + 13, 2, 27);
86   __builtin_memcpy (b + 4, a + 17, 23);
87   baz (a, b);
88 }
89