From c78f1e25a5b020c1b72b16263a439f869ab0f696 Mon Sep 17 00:00:00 2001 From: Yuri Rumyantsev Date: Mon, 1 Dec 2014 12:19:28 +0000 Subject: [PATCH] re PR tree-optimization/63941 (ICE on valid code at -O3 and above on x86_64-linux-gnu) gcc/ PR tree-optimization/63941 * tree-if-conv.c (add_to_predicate_list): Delete wrong assertion that DOM_BB has non-true predicate, conditionally set non-true predicate for BB. gcc/testsuite/ PR tree-optimization/63941 * gcc.dg/torture/pr63941.c: New test. From-SVN: r218206 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr63941.c | 20 ++++++++++++++++++++ gcc/tree-if-conv.c | 6 ++++-- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr63941.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2530e023be4..bf7a61afa31 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-12-01 Yuri Rumyantsev + + PR tree-optimization/63941 + * tree-if-conv.c (add_to_predicate_list): Delete wrong assertion that + DOM_BB has non-true predicate, conditionally set non-true predicate + for BB. + 2014-12-01 Martin Jambor PR ipa/63551 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6fd7162c817..cb8bef7d901 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-01 Yuri Rumyantsev + + PR tree-optimization/63941 + * gcc.dg/torture/pr63941.c: New test. + 2014-12-01 Martin Jambor PR ipa/63551 diff --git a/gcc/testsuite/gcc.dg/torture/pr63941.c b/gcc/testsuite/gcc.dg/torture/pr63941.c new file mode 100644 index 00000000000..3c7c9986446 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr63941.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int a, b, c, d[1], e, f, g, h; + +void +fn1 () +{ + char i = 0; + for (b = 0; b >= 0;) + for (b = 0; b < 2; b++) + { + d[f] && (e = 0); + h = 1 & a - i ? 0 : a; + c = i = h; + char j = c; + int k = 0; + g = j || j > k; + d[0] = 0; + } +} diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index f7befac6f5f..269fda50ebe 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -435,8 +435,10 @@ add_to_predicate_list (struct loop *loop, basic_block bb, tree nc) { gcc_assert (flow_bb_inside_loop_p (loop, dom_bb)); bc = bb_predicate (dom_bb); - gcc_assert (!is_true_predicate (bc)); - set_bb_predicate (bb, bc); + if (!is_true_predicate (bc)) + set_bb_predicate (bb, bc); + else + gcc_assert (is_true_predicate (bb_predicate (bb))); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Use predicate of bb#%d for bb#%d\n", dom_bb->index, bb->index); -- 2.30.2