re PR middle-end/31095 (ICE in expand_expr_real_1, at expr.c:8786)
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Wed, 23 May 2007 01:17:14 +0000 (01:17 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 23 May 2007 01:17:14 +0000 (18:17 -0700)
2007-05-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/31095
         * builtins.c (expand_builtin_memmove_args): Strip nops that don't
        change the type before looking for a COMPOUND_EXPR.

2007-05-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/31095
        * gcc.c-torture/compile/bcopy-1.c: New testcase.

From-SVN: r124975

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/bcopy-1.c [new file with mode: 0644]

index 484a6e81c4304a5c583c1d5c823f12baeb85bd88..c882b1e54bbf69a08e250de4e67bce6629dc439b 100644 (file)
@@ -1,3 +1,9 @@
+2007-05-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR middle-end/31095
+        * builtins.c (expand_builtin_memmove_args): Strip nops that don't
+       change the type before looking for a COMPOUND_EXPR.
+
 2007-05-22  Ian Lance Taylor  <iant@google.com>
 
        * lower-subreg.c (decompose_multiword_subregs): If we change an
index b4f61868205ce9097607ef46c33860b22aec6fa6..80f89788632f697d80a62bf85db63fe933907fb9 100644 (file)
@@ -3485,6 +3485,7 @@ expand_builtin_memmove_args (tree dest, tree src, tree len,
 
   if (result)
     {
+      STRIP_TYPE_NOPS (result);
       while (TREE_CODE (result) == COMPOUND_EXPR)
        {
          expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
index 0c4e1a202fe1051bcbbc7e458d63d61bd53d34aa..bf555817b5b60d023b190c5b3e0291c8f2f3b6bf 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR middle-end/31095
+       * gcc.c-torture/compile/bcopy-1.c: New testcase.
+
 2007-05-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/31606
diff --git a/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c b/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c
new file mode 100644 (file)
index 0000000..5d3a882
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR middle-end/31095, expand_builtin_memmove_args forgot to take into
+   account that tree folding of builtins can add an extra NOP_EXPR.   */
+
+struct timeval
+{
+  int tv_sec;
+  int tv_usec;
+};
+void
+capture_next_packet (void)
+{
+  struct timeval past, now, then;
+  __builtin_bcopy (&then, &past, sizeof (then));
+}