aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr70740-1.c
blob: 77e6a2d71876a3557c2a92361239ccae8051dab3 (plain)
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
/* { dg-do compile } */

/* This is an alternative to the original pr70740.c testcase,
   arrays are now 1 in size where they were 0 in the other testcase. */

extern int foo (void);
extern void *memcpy (void *, const void *, __SIZE_TYPE__);

struct
{
  char a[6];
} d;
struct
{
  int a1[1];
  int a2[1];
  int a3[1];
  int a4[1];
} a, c;
int b;

int *
bar ()
{
  if (b)
    return a.a4;
  return a.a2;
}

void
baz ()
{
  int *e, *f;
  if (foo ())
    e = c.a3;
  else
    e = c.a1;
  memcpy (d.a, e, 6);
  f = bar ();
  memcpy (d.a, f, 1);
}