OSDN Git Service

testsuite/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 990211-1.c
1 /* Copyright (C) 1999 Free Software Foundation, Inc.
2   Contributed by Nathan Sidwell 20 Jan 1999 <nathan@acm.org> */
3
4 /* check range combining boolean operations work */
5
6 extern void abort();
7
8 #define N 77
9
10 void func(int i)
11 {
12   /* fold-const does some clever things with range tests. Make sure
13      we get (some of) them right */
14   
15   /* these must fail, regardless of the value of i */
16   if ((i < 0) && (i >= 0))
17     abort();
18   if ((i > 0) && (i <= 0))
19     abort();
20   if ((i >= 0) && (i < 0))
21     abort();
22   if ((i <= 0) && (i > 0))
23     abort();
24
25   if ((i < N) && (i >= N))
26     abort();
27   if ((i > N) && (i <= N))
28     abort();
29   if ((i >= N) && (i < N))
30     abort();
31   if ((i <= N) && (i > N))
32     abort();
33     
34   /* these must pass, regardless of the value of i */
35   if (! ((i < 0) || (i >= 0)))
36     abort();
37   if (! ((i > 0) || (i <= 0)))
38     abort();
39   if (! ((i >= 0) || (i < 0)))
40     abort();
41   if (! ((i <= 0) || (i > 0)))
42     abort();
43
44   if (! ((i < N) || (i >= N)))
45     abort();
46   if (! ((i > N) || (i <= N)))
47     abort();
48   if (! ((i >= N) || (i < N)))
49     abort();
50   if (! ((i <= N) || (i > N)))
51     abort();
52   
53   return;
54 }
55
56 int main()
57 {
58   func(0);
59   func(1);
60   return 0;
61 }