diff mbox

More restrict testcases

Message ID alpine.LNX.2.00.1310291514200.11149@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Oct. 29, 2013, 2:15 p.m. UTC
Just figured while "optimizing" Michas ADD_RESTRICT patch ...
(well, make it "work").

Tested on x86_64-unknown-linux-gnu, committed.

Richard.

2013-10-29  Richard Biener  <rguenther@suse.de>

	* gcc.dg/torture/restrict-2.c: New testcase.
	* gcc.dg/torture/restrict-3.c: Likewise.
	* gcc.dg/torture/restrict-4.c: Likewise.
	* gcc.dg/torture/restrict-5.c: Likewise.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/torture/restrict-2.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/restrict-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/restrict-2.c	(working copy)
@@ -0,0 +1,27 @@ 
+/* { dg-do run } */
+
+extern void abort (void);
+
+static inline void
+foo (int * p)
+{
+  int * __restrict pr = p;
+  *pr = 1;
+}
+
+int __attribute__((noinline,noclone))
+bar (int *q)
+{
+  int * __restrict qr = q;
+  *qr = 0;
+  foo (qr);
+  return *qr;
+}
+
+int main()
+{
+  int i;
+  if (bar (&i) != 1)
+    abort ();
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/torture/restrict-3.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/restrict-3.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/restrict-3.c	(working copy)
@@ -0,0 +1,26 @@ 
+/* { dg-do run } */
+
+extern void abort (void);
+
+static inline void
+foo (int * __restrict pr)
+{
+  *pr = 1;
+}
+
+int __attribute__((noinline,noclone))
+bar (int *q)
+{
+  int * __restrict qr = q;
+  *qr = 0;
+  foo (qr);
+  return *qr;
+}
+
+int main()
+{
+  int i;
+  if (bar (&i) != 1)
+    abort ();
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/torture/restrict-4.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/restrict-4.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/restrict-4.c	(working copy)
@@ -0,0 +1,26 @@ 
+/* { dg-do run } */
+
+extern void abort (void);
+
+static inline void
+foo (int * p)
+{
+  int * __restrict pr = p;
+  *pr = 1;
+}
+
+int __attribute__((noinline,noclone))
+bar (int * __restrict qr)
+{
+  *qr = 0;
+  foo (qr);
+  return *qr;
+}
+
+int main()
+{
+  int i;
+  if (bar (&i) != 1)
+    abort ();
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/torture/restrict-5.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/restrict-5.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/restrict-5.c	(working copy)
@@ -0,0 +1,25 @@ 
+/* { dg-do run } */
+
+extern void abort (void);
+
+static inline void
+foo (int * __restrict pr)
+{
+  *pr = 1;
+}
+
+int __attribute__((noinline,noclone))
+bar (int * __restrict qr)
+{
+  *qr = 0;
+  foo (qr);
+  return *qr;
+}
+
+int main()
+{
+  int i;
+  if (bar (&i) != 1)
+    abort ();
+  return 0;
+}