summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2646174.c
blob: 4851a7bad76cce96fde288be3db711acc779f647 (plain) (blame)
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
/*
   bug-2646174.c
*/

#include <testfwk.h>

#include <string.h>

struct foo1
{
  int x;
  int y;
};

struct foo2
{
  struct foo1 base_position;
  struct foo1 direction;
};

void
f(struct foo1 *a, const struct foo2 *d)
{
  memcpy(a, &(d->direction), sizeof(struct foo1));
}

void
test_2646174(void)
{
  struct foo2 x;
  struct foo1 y;
  y.x = 0;
  x.direction.x = 1;
  f(&y, &x);
  ASSERT( y.x == 1 );
}