re PR tree-optimization/63941 (ICE on valid code at -O3 and above on x86_64-linux...
authorYuri Rumyantsev <ysrumyan@gmail.com>
Mon, 1 Dec 2014 12:19:28 +0000 (12:19 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Mon, 1 Dec 2014 12:19:28 +0000 (12:19 +0000)
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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr63941.c [new file with mode: 0644]
gcc/tree-if-conv.c

index 2530e023be4b0d520b0d28d154309c0161395100..bf7a61afa3184514ce8938c29ebe6664c77408c9 100644 (file)
@@ -1,3 +1,10 @@
+2014-12-01  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       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  <mjambor@suse.cz>
 
        PR ipa/63551
index 6fd7162c8175794f33bd905c5af37c8cf84f42af..cb8bef7d901bb193a9614397cfe000b0650e5b6d 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-01  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       PR tree-optimization/63941
+       * gcc.dg/torture/pr63941.c: New test.
+
 2014-12-01  Martin Jambor  <mjambor@suse.cz>
 
        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 (file)
index 0000000..3c7c998
--- /dev/null
@@ -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;
+      }
+}
index f7befac6f5fae4fe92e69f04f5c672d20b319f18..269fda50ebe6a10a82c6ab7455ae714744d19127 100644 (file)
@@ -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);