summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20040309-1.c
blob: 49fa79560c60b4ca545f8575d64b527d379b9216 (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
extern void abort ();

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

int main()
{
  if (foo (0) != 0)
    abort ();
  if (foo (32767) != 0)
    abort ();
  if (foo (32768) != 0)
    abort ();
  if (foo (32769) != 1)
    abort ();
  if (foo (65535) != 32767)
    abort ();
  return 0;
}