OSDN Git Service

* expr.c (highest_pow2_factor_for_type): Rename into
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / compare-3.c
1 /* Copyright (C) 2002 Free Software Foundation.
2
3    Test for composite comparison always true/false optimization.
4
5    Written by Roger Sayle, 7th June 2002.  */
6
7 extern void link_error0 ();
8 extern void link_error1 ();
9
10 void
11 test1 (int x, int y)
12 {
13   if ((x==y) && (x!=y))
14     link_error0();
15 }
16
17 void
18 test2 (int x, int y)
19 {
20   if ((x<y) && (x>y))
21     link_error0();
22 }
23
24 void
25 test3 (int x, int y)
26 {
27   if ((x<y) && (y<x))
28     link_error0();
29 }
30
31 void 
32 test4 (int x, int y)
33 {
34   if ((x==y) || (x!=y))
35     {
36     }
37   else
38     link_error1 ();
39 }
40
41 void
42 test5 (int x, int y)
43 {
44   if ((x>=y) || (x<y))
45     {
46     }
47   else
48     link_error1 ();
49 }
50
51 void
52 test6 (int x, int y)
53 {
54   if ((x<=y) || (y<x))
55     {
56     }
57   else
58     link_error1 ();
59 }
60
61 void
62 all_tests (int x, int y)
63 {
64   test1 (x, y);
65   test2 (x, y);
66   test3 (x, y);
67   test4 (x, y);
68   test5 (x, y);
69   test6 (x, y);
70 }
71
72 int
73 main ()
74 {
75   all_tests (0, 0);
76   all_tests (1, 2);
77   all_tests (4, 3);
78
79   return 0;
80 }
81
82 #ifndef __OPTIMIZE__
83 void link_error0() {}
84 void link_error1() {}
85 #endif /* ! __OPTIMIZE__ */
86