summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/960311-3.c
blob: 755fc723f85a3b9eedc156838c327e0c6ee340a3 (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 long data)
{
  if (data & 0x80000000) a1();
  data <<= 1;

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

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

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

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

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

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

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

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

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

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

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