summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-930603-3.c
blob: 3d52864df7e2a6216008f5223513ab6f4cccb938 (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
/*
   930603-3.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

int f (unsigned char *b, int c)
{
  unsigned long v = 0;
  switch (c)
    {
    case 'd':
      v = ((unsigned long)b[0] << 8) + b[1];
      v >>= 9;
      break;

    case 'k':
      v = b[3] >> 4;
      break;

    default:
      ASSERT (0);
    }

  return v;
}
void
testTortureExecute (void)
{
  char buf[4];
  buf[0] = 170; buf[1] = 5;
  if (f (buf, 'd') != 85)
    ASSERT (0);
  return;
}