File: pr78408-1.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (88 lines) | stat: -rw-r--r-- 1,550 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* PR c/78408 */
/* { dg-do compile { target size32plus } } */
/* { dg-options "-O2 -fdump-tree-fab1-details" } */
/* { dg-final { scan-tree-dump-times "after previous" 17 "fab1" } } */

struct S { char a[32]; };
struct T { char a[65536]; };
void bar (int, struct S *, struct S *, struct T *, struct T *);
void baz (char *, char *);

void
f1 (void)
{
  struct S a, b;
  struct T c, d;
  a = b = (struct S) {};
  c = d = (struct T) {};
  bar (1, &a, &b, &c, &d);
}

void
f2 (void)
{
  struct S a, b;
  struct T c, d;
  b = (struct S) {};
  a = b;
  d = (struct T) {};
  c = d;
  bar (2, &a, &b, &c, &d);
}

void
f3 (void)
{
  struct S a, b;
  struct T c, d;
  __builtin_memset (&b, 0, sizeof (b));
  a = b;
  __builtin_memset (&d, 0, sizeof (d));
  c = d;
  bar (3, &a, &b, &c, &d);
}


void
f4 (void)
{
  struct S a, b;
  struct T c, d;
  b = (struct S) {};
  __builtin_memcpy (&a, &b, sizeof (b));
  d = (struct T) {};
  __builtin_memcpy (&c, &d, sizeof (d));
  bar (4, &a, &b, &c, &d);
}

void
f5 (void)
{
  struct S a, b;
  struct T c, d;
  __builtin_memset (&b, 0, sizeof (b));
  __builtin_memcpy (&a, &b, sizeof (b));
  __builtin_memset (&d, 0, sizeof (d));
  __builtin_memcpy (&c, &d, sizeof (d));
  bar (5, &a, &b, &c, &d);
}

void
f6 (void)
{
  struct S a, b, e, g;
  struct T c, d, f, h;
  g = e = a = b = (struct S) {};
  h = f = c = d = (struct T) {};
  bar (6, &a, &b, &c, &d);
  bar (6, &e, &g, &f, &h);
}

void
f7 (void)
{
  char a[64], b[64];
  __builtin_memset (a + 13, 2, 27);
  __builtin_memcpy (b + 4, a + 17, 23);
  baz (a, b);
}