From 47b8392308f4122cb327d351e0f2f34e1b4960bc Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 2 Jun 2016 23:20:16 -0600 Subject: [PATCH] re PR tree-optimization/71328 (ice in verify_jump_thread) PR tree-optimization/71328 * tree-ssa-threadupdate.c (duplicate_thread_path): Fix off-by-one error when checking for a jump back onto the copied path. */ PR tree-optimization/71328 * gcc.c-torture/compile/pr71328.c: New test. From-SVN: r237052 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr71328.c | 16 ++++++++++++++++ gcc/tree-ssa-threadupdate.c | 4 ++-- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr71328.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a0951bfe96..2c6f6b12cc5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-02 Jeff Law + + PR tree-optimization/71328 + * tree-ssa-threadupdate.c (duplicate_thread_path): Fix off-by-one + error when checking for a jump back onto the copied path. */ + 2016-06-02 David Malcolm * config/microblaze/microblaze.c (get_branch_target): Add return diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f7da169de6..263d91b585b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-02 Jeff Law + + PR tree-optimization/71328 + * gcc.c-torture/compile/pr71328.c: New test. + 2016-06-02 Jerry DeLisle PR fortran/52393 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71328.c b/gcc/testsuite/gcc.c-torture/compile/pr71328.c new file mode 100644 index 00000000000..aa384e82965 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr71328.c @@ -0,0 +1,16 @@ + + +int a, b, c; +void fn1() { + unsigned char d = 3; + if (d > 11) + lbl_596: + c = 0; + while (!d) + b = b; + unsigned char e = e || d; + d = e; + if (a) + d = d || a; + goto lbl_596; +} diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 620948c254e..1ff007a495a 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -2298,11 +2298,11 @@ duplicate_thread_path (edge entry, edge exit, } /* Special case the last block on the path: make sure that it does not - jump back on the copied path. */ + jump back on the copied path, including back to itself. */ if (i + 1 == n_region) { FOR_EACH_EDGE (e, ei, bb->succs) - if (bb_in_bbs (e->dest, region_copy, n_region - 1)) + if (bb_in_bbs (e->dest, region_copy, n_region)) { basic_block orig = get_bb_original (e->dest); if (orig) -- 2.30.2