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 484a6e8..c882b1e 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 b4f6186..80f8978 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 0c4e1a2..bf55581 100644 (file)
@@ -1,5 +1,10 @@
 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
        * gcc.c-torture/20070522-1.c: New testcase.
 
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));
+}