From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/gcc.dg/tree-ssa/pr42640.c | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr42640.c (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr42640.c') 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; +} -- cgit v1.2.3