summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c
blob: 06a40a720999964bd7d7009e13d7bc8d8507e406 (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
typedef struct
{
  unsigned char a __attribute__ ((packed));
  unsigned short b __attribute__ ((packed));
} three_byte_t;

unsigned char
f (void)
{
  return 0xab;
}

unsigned short
g (void)
{
  return 0x1234;
}

main ()
{
  three_byte_t three_byte;

  three_byte.a = f ();
  three_byte.b = g ();
  if (three_byte.a != 0xab || three_byte.b != 0x1234)
    abort ();
  exit (0);
}