OSDN Git Service

PR middle-end/35456
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / divcmp-2.c
1 extern void abort (void);
2
3 int test1(int x)
4 {
5   return x/10 == 2;
6 }
7
8 int test2(int x)
9 {
10   return x/10 == 0;
11 }
12
13 int test3(int x)
14 {
15   return x/10 == -2;
16 }
17
18 int test4(int x)
19 {
20   return x/-10 == 2;
21 }
22
23 int test5(int x)
24 {
25   return x/-10 == 0;
26 }
27
28 int test6(int x)
29 {
30   return x/-10 == -2;
31 }
32
33
34 int main()
35 {
36   if (test1(19) != 0)
37     abort ();
38   if (test1(20) != 1)
39     abort ();
40   if (test1(29) != 1)
41     abort ();
42   if (test1(30) != 0)
43     abort ();
44
45   if (test2(-10) != 0)
46     abort ();
47   if (test2(-9) != 1)
48     abort ();
49   if (test2(9) != 1)
50     abort ();
51   if (test2(10) != 0)
52     abort ();
53
54   if (test3(-30) != 0)
55     abort ();
56   if (test3(-29) != 1)
57     abort ();
58   if (test3(-20) != 1)
59     abort ();
60   if (test3(-19) != 0)
61     abort ();
62
63   if (test4(-30) != 0)
64     abort ();
65   if (test4(-29) != 1)
66     abort ();
67   if (test4(-20) != 1)
68     abort ();
69   if (test4(-19) != 0)
70     abort ();
71
72   if (test5(-10) != 0)
73     abort ();
74   if (test5(-9) != 1)
75     abort ();
76   if (test5(9) != 1)
77     abort ();
78   if (test5(10) != 0)
79     abort ();
80
81   if (test6(19) != 0)
82     abort ();
83   if (test6(20) != 1)
84     abort ();
85   if (test6(29) != 1)
86     abort ();
87   if (test6(30) != 0)
88     abort ();
89
90   return 0;
91 }
92