20000906-1.c: Move ...
authorRichard Henderson <rth@cygnus.com>
Tue, 19 Sep 2000 02:10:27 +0000 (19:10 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 19 Sep 2000 02:10:27 +0000 (19:10 -0700)
        * gcc.c-torture/execute/20000906-1.c: Move ...
        * gcc.dg/20000906-1.c: ... here.  Only run on targets
        that support __builtin_trap.

From-SVN: r36522

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20000906-1.c [deleted file]
gcc/testsuite/gcc.dg/20000906-1.c [new file with mode: 0644]

index 68eb6f2011b1d04c09c439e13838dfc59666c73b..8fe3a91cdbc64ee1111c9d0182d5096a625c22dd 100644 (file)
@@ -1,3 +1,9 @@
+2000-09-18  Richard Henderson  <rth@cygnus.com>
+
+       * gcc.c-torture/execute/20000906-1.c: Move ...
+       * gcc.dg/20000906-1.c: ... here.  Only run on targets
+       that support __builtin_trap.
+
 Mon 18-Sep-2000 19:23:11 BST  Neil Booth  <NeilB@earthling.net>
 
        * gcc.dg/cpp/cmdlne-C.c: Remove bogus warning test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000906-1.c b/gcc/testsuite/gcc.c-torture/execute/20000906-1.c
deleted file mode 100644 (file)
index 8665f1b..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Testcase distilled from glibc's nss_parse_service_list in nss/nsswitch.c
-   It can't be distilled further.  Fails with `-O2' for i[3456]86.  */
-
-/* this simulates a bounded-pointer type.  */
-struct ucharp { unsigned char *v, *l, *h; };
-
-/* this simulates bounded-pointer check prior to pointer dereference.  */
-#define AREF(var, idx) ((((((((var).v+(idx)) < (var).l) \
-                          || (((var).v+(idx)+1) > (var).h))) \
-                         && (__builtin_trap (), 0)), \
-                        (var).v)[(idx)])
-
-struct list
-{
-  struct list *next;
-};
-
-struct list *
-alloc_list (void)
-{
-  static struct list l;
-  return &l;
-}
-
-int one = 1;
-
-void
-foo (struct ucharp cp, struct ucharp lp, struct list **nextp)
-{
-  while (1)
-    {
-      struct list *list;
-      while (AREF (lp, 0) && AREF (cp, AREF (lp, 0)))
-        ++lp.v;
-      list = alloc_list ();
-      while (AREF (cp, AREF (lp, 0)))
-        ++lp.v;
-      if (AREF (lp, 0) == one)
-       do
-         ++lp.v;
-       while (AREF (lp, 0) && AREF (cp, AREF (lp, 0)));
-      /* The above AREF (cp, ...) fails because the pseudo created to
-        hold cp.v holds garbage, having never been set.
-        The easiest way to see the problem is to compile wiht `-O2 -da'
-        then look at *.09.loop.  Search for something like this:
-
-        Hoisted regno 183 r/o from (mem/s:SI (reg:SI 16 argp) 10)
-          Replaced reg 91, deleting init_insn (213).
-
-        Now, look for the use of reg 91, which has no set.  */
-
-      *nextp = list;
-      nextp = &list->next;
-      if (!*lp.v)
-       break;
-    }
-}
-
-extern void exit (int);
-
-int
-main (void)
-{
-  static unsigned char cp0[] = "\0\0\0\0";
-  struct ucharp cp = { cp0, cp0, cp0 + sizeof (cp0) };
-
-  static unsigned char lp0[] = "\1\1\0\0";
-  struct ucharp lp = { lp0, lp0, lp0 + sizeof (lp0) };
-
-  struct list list;
-  struct list *nextp = &list;
-
-  foo (cp, lp, &nextp);
-
-  exit (0);
-}
diff --git a/gcc/testsuite/gcc.dg/20000906-1.c b/gcc/testsuite/gcc.dg/20000906-1.c
new file mode 100644 (file)
index 0000000..7edfc02
--- /dev/null
@@ -0,0 +1,79 @@
+/* The target must support __builtin_trap to run this test.  */
+/* { dg-do run { target i?86-* mips*-* powerpc*-* m68k-* sparc*-* i960*-* } } */
+
+/* Testcase distilled from glibc's nss_parse_service_list in nss/nsswitch.c
+   It can't be distilled further.  Fails with `-O2' for i[3456]86.  */
+
+/* this simulates a bounded-pointer type.  */
+struct ucharp { unsigned char *v, *l, *h; };
+
+/* this simulates bounded-pointer check prior to pointer dereference.  */
+#define AREF(var, idx) ((((((((var).v+(idx)) < (var).l) \
+                          || (((var).v+(idx)+1) > (var).h))) \
+                         && (__builtin_trap (), 0)), \
+                        (var).v)[(idx)])
+
+struct list
+{
+  struct list *next;
+};
+
+struct list *
+alloc_list (void)
+{
+  static struct list l;
+  return &l;
+}
+
+int one = 1;
+
+void
+foo (struct ucharp cp, struct ucharp lp, struct list **nextp)
+{
+  while (1)
+    {
+      struct list *list;
+      while (AREF (lp, 0) && AREF (cp, AREF (lp, 0)))
+        ++lp.v;
+      list = alloc_list ();
+      while (AREF (cp, AREF (lp, 0)))
+        ++lp.v;
+      if (AREF (lp, 0) == one)
+       do
+         ++lp.v;
+       while (AREF (lp, 0) && AREF (cp, AREF (lp, 0)));
+      /* The above AREF (cp, ...) fails because the pseudo created to
+        hold cp.v holds garbage, having never been set.
+        The easiest way to see the problem is to compile wiht `-O2 -da'
+        then look at *.09.loop.  Search for something like this:
+
+        Hoisted regno 183 r/o from (mem/s:SI (reg:SI 16 argp) 10)
+          Replaced reg 91, deleting init_insn (213).
+
+        Now, look for the use of reg 91, which has no set.  */
+
+      *nextp = list;
+      nextp = &list->next;
+      if (!*lp.v)
+       break;
+    }
+}
+
+extern void exit (int);
+
+int
+main (void)
+{
+  static unsigned char cp0[] = "\0\0\0\0";
+  struct ucharp cp = { cp0, cp0, cp0 + sizeof (cp0) };
+
+  static unsigned char lp0[] = "\1\1\0\0";
+  struct ucharp lp = { lp0, lp0, lp0 + sizeof (lp0) };
+
+  struct list list;
+  struct list *nextp = &list;
+
+  foo (cp, lp, &nextp);
+
+  exit (0);
+}