Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.c-torture / execute / 20020510-1.c
blob90fb277555788ca32a323aed79da76ae62504346
1 /* Copyright (C) 2002 Free Software Foundation.
3 Test that optimizing ((c>=1) && (c<=127)) into (signed char)c < 0
4 doesn't cause any problems for the compiler and behaves correctly.
6 Written by Roger Sayle, 8th May 2002. */
8 #include <limits.h>
10 extern void abort (void);
12 void
13 testc (unsigned char c, int ok)
15 if ((c>=1) && (c<=SCHAR_MAX))
17 if (!ok) abort ();
19 else
20 if (ok) abort ();
23 void
24 tests (unsigned short s, int ok)
26 if ((s>=1) && (s<=SHRT_MAX))
28 if (!ok) abort ();
30 else
31 if (ok) abort ();
34 void
35 testi (unsigned int i, int ok)
37 if ((i>=1) && (i<=INT_MAX))
39 if (!ok) abort ();
41 else
42 if (ok) abort ();
45 void
46 testl (unsigned long l, int ok)
48 if ((l>=1) && (l<=LONG_MAX))
50 if (!ok) abort ();
52 else
53 if (ok) abort ();
56 int
57 main ()
59 testc (0, 0);
60 testc (1, 1);
61 testc (SCHAR_MAX, 1);
62 testc (SCHAR_MAX+1, 0);
63 testc (UCHAR_MAX, 0);
65 tests (0, 0);
66 tests (1, 1);
67 tests (SHRT_MAX, 1);
68 tests (SHRT_MAX+1, 0);
69 tests (USHRT_MAX, 0);
71 testi (0, 0);
72 testi (1, 1);
73 testi (INT_MAX, 1);
74 testi (INT_MAX+1U, 0);
75 testi (UINT_MAX, 0);
77 testl (0, 0);
78 testl (1, 1);
79 testl (LONG_MAX, 1);
80 testl (LONG_MAX+1UL, 0);
81 testl (ULONG_MAX, 0);
83 return 0;