This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] More restrict testcases
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Oct 2013 15:15:25 +0100 (CET)
- Subject: [PATCH] More restrict testcases
- Authentication-results: sourceware.org; auth=none
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.
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;
+}