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]
Other format: [Raw text]

[PATCH] Testcase for PR debug/43051


Hi!

Here is corresponding testcase for PR debug/43051:

2010-02-17  Jakub Jelinek  <jakub@redhat.com>

	PR debug/43051
	* gcc.dg/guality/pr43051-1.c: New test.

--- gcc/testsuite/gcc.dg/guality/pr43051-1.c.jj	2010-02-17 10:17:12.000000000 +0100
+++ gcc/testsuite/gcc.dg/guality/pr43051-1.c	2010-02-17 10:41:43.000000000 +0100
@@ -0,0 +1,57 @@
+/* PR debug/43051 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+extern void abort (void);
+
+static void __attribute__ ((noinline))
+foo (const char *x, long long y, int z)
+{
+  asm volatile ("" : : "r" (x), "r" ((int) y), "r" (z) : "memory");
+}
+
+struct S
+{
+  struct S *n;
+  int v;
+};
+
+struct S a[10];
+
+struct S * __attribute__ ((noinline))
+bar (struct S *c, int v, struct S *e)
+{
+#ifdef __i386__
+  register int si asm ("esi"), di asm ("edi"), bx
+# if !defined (__pic__) && !defined (__APPLE__)
+    asm ("ebx")
+# endif
+    ;
+  asm volatile ("" : "=r" (si), "=r" (di), "=r" (bx));
+#endif
+  while (c < e)
+    {
+      foo ("c", (__UINTPTR_TYPE__) c, 0);	/* { dg-final { gdb-test 34 "c" "\&a\[0\]" } } */
+      foo ("v", v, 1);				/* { dg-final { gdb-test 35 "v" "1" } } */
+      foo ("e", (__UINTPTR_TYPE__) e, 2);	/* { dg-final { gdb-test 36 "e" "\&a\[1\]" } } */
+      if (c->v == v)
+	return c;
+      foo ("c", (__UINTPTR_TYPE__) c, 3);	/* { dg-final { gdb-test 39 "c" "\&a\[0\]" } } */
+      foo ("v", v, 4);				/* { dg-final { gdb-test 40 "v" "1" } } */
+      foo ("e", (__UINTPTR_TYPE__) e, 5);	/* { dg-final { gdb-test 41 "e" "\&a\[1\]" } } */
+      c++;
+    }
+#ifdef __i386__
+  asm volatile ("" : : "r" (si), "r" (di), "r" (bx));
+#endif
+  return 0;
+}
+
+int
+main ()
+{
+  asm volatile ("" : : "r" (&a[0]) : "memory");
+  if (bar (&a[a[0].v], a[0].v + 1, &a[a[0].v + 1]))
+    abort ();
+  return 0;
+}

	Jakub


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