OSDN Git Service

* gcc.c-torture/execute/ieee/rbug.x: XFAIL FreeBSD 5.x.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / enum-2.c
1 /* Copyright (C) 2000 Free Software Foundation */
2 /* by Alexandre Oliva  <aoliva@redhat.com> */
3
4 enum foo { FOO, BAR };
5
6 /* Even though the underlying type of an enum is unspecified, the type
7    of enumeration constants is explicitly defined as int (6.4.4.3/2 in
8    the C99 Standard).  Therefore, `i' must not be promoted to
9    `unsigned' in the comparison below; we must exit the loop when it
10    becomes negative. */
11
12 int
13 main ()
14 {
15   int i;
16   for (i = BAR; i >= FOO; --i)
17     if (i == -1)
18       abort ();
19
20   exit (0);
21 }
22