2002-05-10 David S. Miller <davem@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / enum-2.c
blobdd6f640861a463215da698014fe394bfe20c59f3
1 /* Copyright (C) 2000 Free Software Foundation */
2 /* by Alexandre Oliva <aoliva@redhat.com> */
4 enum foo { FOO, BAR };
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. */
12 int
13 main ()
15 int i;
16 for (i = BAR; i >= FOO; --i)
17 if (i == -1)
18 abort ();
20 exit (0);