Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/960311-3.c

raw
1 #include <stdio.h>
2
3 void abort (void);
4 void exit (int);
5
6 #ifdef DEBUG
7 #define abort() printf ("error, line %d\n", __LINE__)
8 #endif
9
10 int count;
11
12 void a1() { ++count; }
13
14 void
15 b (unsigned long data)
16 {
17 if (data & 0x80000000) a1();
18 data <<= 1;
19
20 if (data & 0x80000000) a1();
21 data <<= 1;
22
23 if (data & 0x80000000) a1();
24 }
25
26 int
27 main (void)
28 {
29 count = 0;
30 b (0);
31 if (count != 0)
32 abort ();
33
34 count = 0;
35 b (0x80000000);
36 if (count != 1)
37 abort ();
38
39 count = 0;
40 b (0x40000000);
41 if (count != 1)
42 abort ();
43
44 count = 0;
45 b (0x20000000);
46 if (count != 1)
47 abort ();
48
49 count = 0;
50 b (0xc0000000);
51 if (count != 2)
52 abort ();
53
54 count = 0;
55 b (0xa0000000);
56 if (count != 2)
57 abort ();
58
59 count = 0;
60 b (0x60000000);
61 if (count != 2)
62 abort ();
63
64 count = 0;
65 b (0xe0000000);
66 if (count != 3)
67 abort ();
68
69 #ifdef DEBUG
70 printf ("Done.\n");
71 #endif
72 exit (0);
73 }