From ad88bb8b2ced823f0dd8aafce8ef0cc40079f67a Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 26 Jul 2000 03:51:55 +0000 Subject: * gcc.c-torture/execute/enum-2.c: New test. From-SVN: r35260 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/execute/enum-2.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/enum-2.c (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1c0fda..8f62cd8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2000-07-26 Alexandre Oliva + + * gcc.c-torture/execute/enum-2.c: New test. + 2000-07-25 Kaveh R. Ghazi * gcc.dg/cpp/tr-warn3.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/enum-2.c b/gcc/testsuite/gcc.c-torture/execute/enum-2.c new file mode 100644 index 0000000..dd6f640 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/enum-2.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* by Alexandre Oliva */ + +enum foo { FOO, BAR }; + +/* Even though the underlying type of an enum is unspecified, the type + of enumeration constants is explicitly defined as int (6.4.4.3/2 in + the C99 Standard). Therefore, `i' must not be promoted to + `unsigned' in the comparison below; we must exit the loop when it + becomes negative. */ + +int +main () +{ + int i; + for (i = BAR; i >= FOO; --i) + if (i == -1) + abort (); + + exit (0); +} + -- cgit v1.1