re PR tree-optimization/64269 (ICE with -O3 enabled on Ubuntu 14.04)
authorJakub Jelinek <jakub@redhat.com>
Fri, 12 Dec 2014 13:32:16 +0000 (14:32 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 12 Dec 2014 13:32:16 +0000 (14:32 +0100)
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: r218669

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

index 95f885bc435c2dbeaa64d36416ee0340f20d513f..44b4ce423799e8f15e3d3b5adf184d1114a98f1e 100644 (file)
@@ -1,3 +1,9 @@
+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-12  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/64280
index 5b485a97708b6c7c19e78303f668e5f0770cd635..9624e3908eb7a0f771e70bf562c4452743c8812e 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/64269
+       * gcc.c-torture/compile/pr64269.c: New test.
+
 2014-12-12  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/64280
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 6c14e135f5ead689e2dfc433f9720bf3acf7258e..e931471b8af913b50429ae3ac2c4387ea6a29a9e 100644 (file)
@@ -1288,7 +1288,8 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
          use_operand_p use_p;
 
          if (!tree_fits_shwi_p (val2)
-             || !tree_fits_uhwi_p (len2))
+             || !tree_fits_uhwi_p (len2)
+             || compare_tree_int (len2, 1024) == 1)
            break;
          if (is_gimple_call (stmt1))
            {
@@ -1354,7 +1355,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
              || !tree_fits_uhwi_p (diff)
-             || 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