struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-enum-2.c
blob12e1a3991ddada6aefe5b2278c541de09cf5c2ab
1 /*
2 enum-2.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) 2000 Free Software Foundation */
12 /* by Alexandre Oliva <aoliva@redhat.com> */
14 enum foo { FOO, BAR };
16 /* Even though the underlying type of an enum is unspecified, the type
17 of enumeration constants is explicitly defined as int (6.4.4.3/2 in
18 the C99 Standard). Therefore, `i' must not be promoted to
19 `unsigned' in the comparison below; we must exit the loop when it
20 becomes negative. */
22 void
23 testTortureExecute (void)
25 int i;
26 for (i = BAR; i >= FOO; --i)
27 if (i == -1)
28 ASSERT (0);
30 return;