Debian Codegraph @

gcc/testsuite/gcc.dg/pr78408-1.c

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