]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/89278 (ICE in gimplify_modify_expr, at gimplify.c:5821)
authorRichard Biener <rguenther@suse.de>
Fri, 15 Feb 2019 07:39:45 +0000 (07:39 +0000)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 15 Feb 2019 07:39:45 +0000 (08:39 +0100)
PR tree-optimization/89278
* tree-loop-distribution.c: Include tree-eh.h.
(generate_memset_builtin, generate_memcpy_builtin): Call
rewrite_to_non_trapping_overflow on builtin->size before passing it
to force_gimple_operand_gsi.

* gcc.dg/pr89278.c: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r268927

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr89278.c [new file with mode: 0644]
gcc/tree-loop-distribution.c

index 6045ad0d2484288522582b1eaa37b9e4194af155..a9b7ed292e83b4957ee60d367aea1b846ed80a42 100644 (file)
@@ -1,3 +1,12 @@
+2019-02-15  Richard Biener  <rguenther@suse.de>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/89278
+       * tree-loop-distribution.c: Include tree-eh.h.
+       (generate_memset_builtin, generate_memcpy_builtin): Call
+       rewrite_to_non_trapping_overflow on builtin->size before passing it
+       to force_gimple_operand_gsi.
+
 2019-02-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR other/89342
index 582d28deb44ff8b257a03ed7c8d1437158648421..6b5b422f66825bcc507a76951a09221e5f24d38a 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-15  Richard Biener  <rguenther@suse.de>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/89278
+       * gcc.dg/pr89278.c: New test.
+
 2019-02-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/89340
diff --git a/gcc/testsuite/gcc.dg/pr89278.c b/gcc/testsuite/gcc.dg/pr89278.c
new file mode 100644 (file)
index 0000000..609cb1a
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR tree-optimization/89278 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftrapv -ftree-loop-distribute-patterns --param max-loop-header-insns=2" } */
+
+void
+foo (int *w, int x, int y, int z)
+{
+  while (x < y + z)
+    {
+      w[x] = 0;
+      ++x;
+    }
+}
+
+void
+bar (int *__restrict u, int *__restrict w, int x, int y, int z)
+{
+  while (x < y + z)
+    {
+      w[x] = u[x];
+      ++x;
+    }
+}
index 7df052de0cf3bd8bc8567642a39fd79de1d41a6b..066356f138eda42140f80c9f5ba94b46fdc9018a 100644 (file)
@@ -114,6 +114,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-scalar-evolution.h"
 #include "params.h"
 #include "tree-vectorizer.h"
+#include "tree-eh.h"
 
 
 #define MAX_DATAREFS_NUM \
@@ -996,7 +997,7 @@ generate_memset_builtin (struct loop *loop, partition *partition)
   /* The new statements will be placed before LOOP.  */
   gsi = gsi_last_bb (loop_preheader_edge (loop)->src);
 
-  nb_bytes = builtin->size;
+  nb_bytes = rewrite_to_non_trapping_overflow (builtin->size);
   nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
                                       false, GSI_CONTINUE_LINKING);
   mem = builtin->dst_base;
@@ -1048,7 +1049,7 @@ generate_memcpy_builtin (struct loop *loop, partition *partition)
   /* The new statements will be placed before LOOP.  */
   gsi = gsi_last_bb (loop_preheader_edge (loop)->src);
 
-  nb_bytes = builtin->size;
+  nb_bytes = rewrite_to_non_trapping_overflow (builtin->size);
   nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
                                       false, GSI_CONTINUE_LINKING);
   dest = builtin->dst_base;