summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20100316-1.c
blob: cb800fb720f62483c67c37165f0d5bd11d103944 (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
38
/*
   20100316-1.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

#ifndef __SDCC_pic16 // TODO: enable when the pic16 ports supports bitfields of size greater than 8 bits!
struct Foo {
  int i;
  unsigned precision : 10;
  unsigned blah : 3;
} f;

int
foo (struct Foo *p)
{
  struct Foo *q = p;
  return (*q).precision;
}
#endif

void
testTortureExecute (void)
{
#ifndef __SDCC_pic16
  f.i = -1;
  f.precision = 0;
  f.blah = -1;
  if (foo (&f) != 0)
    ASSERT (0);
  return;
#endif
}