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

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

int foo(unsigned short x)
{
  unsigned short y;
  y = x > 32767 ? x - 32768 : 0;
  return y;
}

void
testTortureExecute (void)
{
  if (foo (0) != 0)
    ASSERT (0);
  if (foo (32767) != 0)
    ASSERT (0);
  if (foo (32768) != 0)
    ASSERT (0);
  if (foo (32769) != 1)
    ASSERT (0);
  if (foo (65535) != 32767)
    ASSERT (0);
  return;
}