summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c
new file mode 100644
index 000000000..73051ae96
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-forwprop1" } */
+
+int f(int *p, int n)
+{
+ int (*a)[n] = (int (*)[n])p;
+ int *q = &(*a)[0];
+ return q[1];
+}
+
+int g(int *p, int n)
+{
+ int (*a)[n] = (int (*)[n])p;
+ int *q = &(*a)[2];
+ return q[-1];
+}
+
+/* { dg-final { scan-tree-dump-times "= \\\(\\\*a_..\\\)\\\[1\\\];" 2 "forwprop1" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "forwprop1" } } */