]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/61684 (ICE at -Os and above on x86_64-linux-gnu in tree check...
authorJakub Jelinek <jakub@redhat.com>
Fri, 4 Jul 2014 08:37:39 +0000 (10:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 4 Jul 2014 08:37:39 +0000 (10:37 +0200)
PR tree-optimization/61684
* tree-ssa-ifcombine.c (recognize_single_bit_test): Make sure
rhs1 of conversion is a SSA_NAME before using SSA_NAME_DEF_STMT on it.

* gcc.c-torture/compile/pr61684.c: New test.

From-SVN: r212292

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr61684.c [new file with mode: 0644]
gcc/tree-ssa-ifcombine.c

index bd902b9bb684d754bd7ed4fc11829f769b800052..678e367b11f440b78f514a9fd67d9e6964293c99 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/61684
+       * tree-ssa-ifcombine.c (recognize_single_bit_test): Make sure
+       rhs1 of conversion is a SSA_NAME before using SSA_NAME_DEF_STMT on it.
+
 2014-06-30  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        Backport from Mainline
index facd6dd0c2d692d77638f6ac4f392a097cc43d92..95ea849ae0654a6ea1c9ec8f3005e05cd65c2544 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/61684
+       * gcc.c-torture/compile/pr61684.c: New test.
+
 2014-07-02  Jakub Jelinek  <jakub@redhat.com>
            Fritz Reese  <Reese-Fritz@zai.com>
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61684.c b/gcc/testsuite/gcc.c-torture/compile/pr61684.c
new file mode 100644 (file)
index 0000000..f5b53b7
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR tree-optimization/61684 */
+
+int a, c;
+static int *b = 0;
+short d;
+static short **e = 0;
+
+void
+foo ()
+{
+  for (; c < 1; c++)
+    ;
+  *e = &d;
+  a = d && (c && 1) & *b;
+}
index ed6ea8261d0758b0c77c1e1f08eb9dc66268b045..186e140d690c205b9492d5b506a402f44080d67f 100644 (file)
@@ -201,7 +201,8 @@ recognize_single_bit_test (gimple cond, tree *name, tree *bit, bool inv)
       while (is_gimple_assign (stmt)
             && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
                  && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt)))
-                     <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt)))))
+                     <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))
+                 && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
                 || gimple_assign_ssa_name_copy_p (stmt)))
        stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));