aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/960311-1.c
blob: 16579d0bbd1e2f74cf997d6338fdcb582b5daa5a (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 char data)
{
  if (data & 0x80) a1();
  data <<= 1;

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

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

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

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

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

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

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

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

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

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

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