* gcc.c-torture/execute/enum-2.c: New test.
From-SVN: r35260
This commit is contained in:
parent
736f85c700
commit
ad88bb8b2c
@ -1,3 +1,7 @@
|
||||
2000-07-26 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* gcc.c-torture/execute/enum-2.c: New test.
|
||||
|
||||
2000-07-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* gcc.dg/cpp/tr-warn3.c: New test.
|
||||
|
22
gcc/testsuite/gcc.c-torture/execute/enum-2.c
Normal file
22
gcc/testsuite/gcc.c-torture/execute/enum-2.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation */
|
||||
/* by Alexandre Oliva <aoliva@redhat.com> */
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user