re PR rtl-optimization/16536 (Incorrect __restrict__ optimization in -O2)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 16 Jul 2004 00:25:59 +0000 (00:25 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 16 Jul 2004 00:25:59 +0000 (00:25 +0000)
PR rtl-optimization/16536
* gcc.c-torture/execute/restrict-1.c: New test.

From-SVN: r84791

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

index 8626dbb85eabc6489a1c63b82dcfaace21fdedd7..1f5163845f1016b9d3420004b198684f59633364 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR rtl-optimization/16536
+       * gcc.c-torture/execute/restrict-1.c: New test.
+
 2004-07-15  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/15324
diff --git a/gcc/testsuite/gcc.c-torture/execute/restrict-1.c b/gcc/testsuite/gcc.c-torture/execute/restrict-1.c
new file mode 100644 (file)
index 0000000..3c5696c
--- /dev/null
@@ -0,0 +1,30 @@
+/*  PR rtl-optimization/16536
+    Origin:  Jeremy Denise      <jeremy.denise@libertysurf.fr>
+    Reduced: Wolfgang Bangerth  <bangerth@dealii.org>
+             Volker Reichelt    <reichelt@igpm.rwth-aachen.de>  */
+
+extern void abort ();
+
+typedef struct
+{
+  int i, dummy;
+} A;
+
+inline A foo (const A* p, const A* q)
+{
+  return (A){p->i+q->i};
+}
+
+void bar (A* __restrict__ p)
+{
+  *p=foo(p,p);
+  if (p->i!=2)
+    abort();
+}
+
+int main ()
+{
+  A a={1};
+  bar(&a);
+  return 0;
+}