This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

New test for negative case labels


I'm checking in this new test.  Apparently, none of the existing tests
catches this failure.  I was doing an unsigned compare of the case
table bounds in a new port.

Index: gcc/testsuite/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* gcc.c-torture/execute/20010106-1.c: New test.

Index: gcc/testsuite/gcc.c-torture/execute/20010106-1.c
===================================================================
RCS file: 20010106-1.c
diff -N 20010106-1.c
--- /dev/null	Tue May  5 13:32:27 1998
+++ gcc/testsuite/gcc.c-torture/execute/20010106-1.c Sat Jan 6 15:12:46 2001
@@ -0,0 +1,30 @@
+/* Copyright 2001 Free Software Foundation
+   Contributed by Alexandre Oliva <aoliva@redhat.com> */
+
+int f(int i) {
+  switch (i)
+  {
+    case -2:
+      return 33;
+    case -1:
+      return 0;
+    case 0:
+      return 7;
+    case 1:
+      return 4;
+    case 2:
+      return 3;
+    case 3:
+      return 15;
+    case 4:
+     return 9;
+    default:
+      abort ();
+  }
+}
+
+int main() {
+  if (f(-1))
+    abort ();
+  exit (0);
+}

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]