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
7extern void link_error0 ();
8extern void link_error1 ();
9
10void
11test1 (int x, int y)
12{
13  if ((x==y) && (x!=y))
14    link_error0();
15}
16
17void
18test2 (int x, int y)
19{
20  if ((x<y) && (x>y))
21    link_error0();
22}
23
24void
25test3 (int x, int y)
26{
27  if ((x<y) && (y<x))
28    link_error0();
29}
30
31void
32test4 (int x, int y)
33{
34  if ((x==y) || (x!=y))
35    {
36    }
37  else
38    link_error1 ();
39}
40
41void
42test5 (int x, int y)
43{
44  if ((x>=y) || (x<y))
45    {
46    }
47  else
48    link_error1 ();
49}
50
51void
52test6 (int x, int y)
53{
54  if ((x<=y) || (y<x))
55    {
56    }
57  else
58    link_error1 ();
59}
60
61void
62all_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
72int
73main ()
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__
83void link_error0() {}
84void link_error1() {}
85#endif /* ! __OPTIMIZE__ */
86
87