aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr54985.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2012-11-02 20:19:16 +0000
committerJeff Law <law@redhat.com>2012-11-02 20:19:16 +0000
commit43a495541968cda004badd45f3937c3155d5846e (patch)
tree85c4824f478fd94300af1e41cbb72d8f98dc9e48 /gcc/testsuite/gcc.c-torture/execute/pr54985.c
parent83e442992c837f126d8d7a34db2810a19e2ca84d (diff)
PR tree-optimization/54985
* tree-ssa-threadedge.c (cond_arg_set_in_bb): New function extracted from thread_across_edge. (thread_across_edge): Use it in all cases where we might thread across a back edge. * gcc.c-torture/execute/pr54985.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@193108 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr54985.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr54985.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr54985.c b/gcc/testsuite/gcc.c-torture/execute/pr54985.c
new file mode 100644
index 00000000000..678c9f47ae7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr54985.c
@@ -0,0 +1,36 @@
+
+typedef struct st {
+ int a;
+} ST;
+
+int __attribute__((noinline,noclone))
+foo(ST *s, int c)
+{
+ int first = 1;
+ int count = c;
+ ST *item = s;
+ int a = s->a;
+ int x;
+
+ while (count--)
+ {
+ x = item->a;
+ if (first)
+ first = 0;
+ else if (x >= a)
+ return 1;
+ a = x;
+ item++;
+ }
+ return 0;
+}
+
+extern void abort (void);
+
+int main ()
+{
+ ST _1[2] = {{2}, {1}};
+ if (foo(_1, 2) != 0)
+ abort ();
+ return 0;
+}