summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr42640.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr42640.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c b/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
new file mode 100644
index 000000000..70807c091
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ftree-loop-distribution" } */
+
+/* Checks if loop distribution works correctly if the subscript used
+ is assigned to a loop invariant value. */
+
+extern void abort (void);
+struct S { int a; int b; int c; };
+
+int get_rr_node_index (int i)
+{
+ return i;
+}
+
+struct S nodes[8];
+struct S *rr_node = nodes;
+volatile int io_rat = 2;
+void
+doit (int i, int j)
+{
+ int s_node, p_node, inode, ipad, iloop;
+
+ for (ipad = 0; ipad < io_rat; ipad++)
+ {
+ p_node = get_rr_node_index (ipad+2);
+ inode = get_rr_node_index (ipad);
+
+ for (iloop = 1; iloop <= 2; iloop++)
+ {
+ rr_node[inode].a = i;
+ rr_node[inode].b = j;
+ rr_node[inode].c = ipad;
+ inode = p_node;
+ }
+ }
+}
+
+int
+main ()
+{
+ int i;
+
+ doit (1, 2);
+
+ if (rr_node[0].a != rr_node[1].a
+ || rr_node[2].a != rr_node[3].a
+ || rr_node[1].a != 1
+ || rr_node[0].b != rr_node[1].b
+ || rr_node[2].b != rr_node[3].b
+ || rr_node[1].b != 2
+ || rr_node[0].c != 0
+ || rr_node[1].c != 1
+ || rr_node[2].c != 0
+ || rr_node[3].c != 1)
+ abort ();
+
+ return 0;
+}