]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/61060 (ICE: in int_mode_for_mode, at stor-layout.c:400 with -free-ter)
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 May 2014 08:28:53 +0000 (10:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 13 May 2014 08:28:53 +0000 (10:28 +0200)
PR target/61060
* config/i386/i386.c (ix86_expand_set_or_movmem): If count_exp
is const0_rtx, return immediately.  Don't test count == 0 when
it is always true.

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

From-SVN: r210352

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr61060.c [new file with mode: 0644]

index be9e41138e3ee306322a401983240eabc74116ea..a829af0f9af6eb03cfacbb1bc39efcaf0e1a6b53 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/61060
+       * config/i386/i386.c (ix86_expand_set_or_movmem): If count_exp
+       is const0_rtx, return immediately.  Don't test count == 0 when
+       it is always true.
+
 2014-05-13  Zhenqiang Chen  <zhenqiang.chen@linaro.org>
 
        * Makefile.in: add shrink-wrap.o.
index b85015f04f74d7aaf3131c7cac7ed6816b1a007a..7a7a3fcc5ea60b02770fb462a3b9c1adc104173e 100644 (file)
@@ -24157,8 +24157,13 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp,
     align = MEM_ALIGN (dst) / BITS_PER_UNIT;
 
   if (CONST_INT_P (count_exp))
-    min_size = max_size = probable_max_size = count = expected_size
-      = INTVAL (count_exp);
+    {
+      min_size = max_size = probable_max_size = count = expected_size
+       = INTVAL (count_exp);
+      /* When COUNT is 0, there is nothing to do.  */
+      if (!count)
+       return true;
+    }
   else
     {
       if (min_size_exp)
@@ -24167,7 +24172,7 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp,
        max_size = INTVAL (max_size_exp);
       if (probable_max_size_exp)
        probable_max_size = INTVAL (probable_max_size_exp);
-      if (CONST_INT_P (expected_size_exp) && count == 0)
+      if (CONST_INT_P (expected_size_exp))
        expected_size = INTVAL (expected_size_exp);
      }
 
index fdbed2fe02008a7f63f7a19937140dfecd201b3f..b99777ebf4173ea072fde66a4cf25f825d912aa5 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/61060
+       * gcc.dg/pr61060.c: New test.
+
 2014-05-12  DJ Delorie  <dj@redhat.com>
 
        * gcc.dg/sibcall-3.c: MSP430 doesn't have sibcall.
diff --git a/gcc/testsuite/gcc.dg/pr61060.c b/gcc/testsuite/gcc.dg/pr61060.c
new file mode 100644 (file)
index 0000000..d2a1365
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR target/61060 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -ftree-ter" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern inline __attribute__ ((gnu_inline, always_inline, artificial))
+void *memset (void *dest, int ch, size_t len)
+{
+  return __builtin_memset (dest, ch, len);
+}
+
+char buf[10];
+
+void
+foo (void)
+{
+  memset (buf, sizeof (buf), 0);
+}