summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/960311-2.c
blob: d5c2d07a336cb41dbb819ec7d6116d833476a0db (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>

#ifdef DEBUG
#define abort() printf ("error, line %d\n", __LINE__)
#endif

int count;

void a1() { ++count; }

void
b (unsigned short data)
{
  if (data & 0x8000) a1();
  data <<= 1;

  if (data & 0x8000) a1();
  data <<= 1;

  if (data & 0x8000) a1();
}

main ()
{
  count = 0;
  b (0);
  if (count != 0)
    abort ();

  count = 0;
  b (0x8000);
  if (count != 1)
    abort ();

  count = 0;
  b (0x4000);
  if (count != 1)
    abort ();

  count = 0;
  b (0x2000);
  if (count != 1)
    abort ();

  count = 0;
  b (0xc000);
  if (count != 2)
    abort ();

  count = 0;
  b (0xa000);
  if (count != 2)
    abort ();

  count = 0;
  b (0x6000);
  if (count != 2)
    abort ();

  count = 0;
  b (0xe000);
  if (count != 3)
    abort ();

#ifdef DEBUG
  printf ("Done.\n");
#endif
  exit (0);
}