struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-compare-3.c
blob3fb226e11fc41ba36aa2c19782af2ab25969a493
1 /*
2 compare-3.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* Copyright (C) 2002 Free Software Foundation.
13 Test for composite comparison always true/false optimization.
15 Written by Roger Sayle, 7th June 2002. */
17 extern void link_error0 ();
18 extern void link_error1 ();
20 void
21 test1 (int x, int y)
23 if ((x==y) && (x!=y))
24 link_error0();
27 void
28 test2 (int x, int y)
30 if ((x<y) && (x>y))
31 link_error0();
34 void
35 test3 (int x, int y)
37 if ((x<y) && (y<x))
38 link_error0();
41 void
42 test4 (int x, int y)
44 if ((x==y) || (x!=y))
47 else
48 link_error1 ();
51 void
52 test5 (int x, int y)
54 if ((x>=y) || (x<y))
57 else
58 link_error1 ();
61 void
62 test6 (int x, int y)
64 if ((x<=y) || (y<x))
67 else
68 link_error1 ();
71 void
72 all_tests (int x, int y)
74 test1 (x, y);
75 test2 (x, y);
76 test3 (x, y);
77 test4 (x, y);
78 test5 (x, y);
79 test6 (x, y);
82 void
83 testTortureExecute (void)
85 all_tests (0, 0);
86 all_tests (1, 2);
87 all_tests (4, 3);
89 return;
92 void link_error0() {ASSERT (0);}
93 void link_error1() {ASSERT (0);}