]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/64269 (ICE with -O3 enabled on Ubuntu 14.04)
authorJakub Jelinek <jakub@redhat.com>
Sat, 13 Dec 2014 08:57:05 +0000 (09:57 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 13 Dec 2014 08:57:05 +0000 (09:57 +0100)
Backported from mainline
2014-12-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/64269
* tree-ssa-forwprop.c (simplify_builtin_call): Bail out if
len2 or diff are too large.

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

From-SVN: r218704

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

index b5ff154ba543dbb8027b0231376369e05bffefb9..fc3b03ef2cffa2f03ec7ab88b81aa6eeca6c307c 100644 (file)
@@ -1,3 +1,12 @@
+2014-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2014-12-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/64269
+       * tree-ssa-forwprop.c (simplify_builtin_call): Bail out if
+       len2 or diff are too large.
+
 2014-12-11  Eric Botcazou  <ebotcazou@adacore.com>
 
        * doc/md.texi (Insn Lengths): Fix description of (pc).
index 5aaa8b7014e506e628a19aaee96ffe8f22c55631..f5b4e957015df931c535f1eb0606e5f48c4b7288 100644 (file)
@@ -1,3 +1,11 @@
+2014-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2014-12-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/64269
+       * gcc.c-torture/compile/pr64269.c: New test.
+
 2014-12-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr64269.c b/gcc/testsuite/gcc.c-torture/compile/pr64269.c
new file mode 100644 (file)
index 0000000..640758d
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR tree-optimization/64269 */
+
+void
+foo (char *p)
+{
+  __SIZE_TYPE__ s = ~(__SIZE_TYPE__)0;
+  *p = 0;
+  __builtin_memset (p + 1, 0, s);
+}
index edcf92918b7d597e704222cee4d447c3c2e9a6dd..d617f5b625d443368f64b6650669bb7bc59da0e4 100644 (file)
@@ -1438,7 +1438,8 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
          use_operand_p use_p;
 
          if (!host_integerp (val2, 0)
-             || !host_integerp (len2, 1))
+             || !host_integerp (len2, 1)
+             || compare_tree_int (len2, 1024) == 1)
            break;
          if (is_gimple_call (stmt1))
            {
@@ -1504,7 +1505,8 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
             is not constant, or is bigger than memcpy length, bail out.  */
          if (diff == NULL
              || !host_integerp (diff, 1)
-             || tree_int_cst_lt (len1, diff))
+             || tree_int_cst_lt (len1, diff)
+             || compare_tree_int (diff, 1024) == 1)
            break;
 
          /* Use maximum of difference plus memset length and memcpy length