OSDN Git Service

gcc/ChangeLog:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Oct 2007 17:05:19 +0000 (17:05 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Oct 2007 17:05:19 +0000 (17:05 +0000)
PR middle-end/33706
* tree-inline.c (copy_bb): Use bsi_replace to replace a
__builtin_va_arg_pack-containing call stmt.
gcc/testsuite/ChangeLog:
PR middle-end/33706
* gcc.dg/va-arg-pack-2.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129355 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/va-arg-pack-2.c [new file with mode: 0644]
gcc/tree-inline.c

index f2849b9..f627ef7 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-15  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR middle-end/33706
+       * tree-inline.c (copy_bb): Use bsi_replace to replace a
+       __builtin_va_arg_pack-containing call stmt.
+
 2007-10-15  Razya Ladelsky  <razya@il.ibm.com>
 
         * matrix-reorg.c (gate_matrix_reorg): Don't comment out whole
index c541b3c..7f09cdd 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-15  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR middle-end/33706
+       * gcc.dg/va-arg-pack-2.c: New.
+
 2007-10-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/33619
diff --git a/gcc/testsuite/gcc.dg/va-arg-pack-2.c b/gcc/testsuite/gcc.dg/va-arg-pack-2.c
new file mode 100644 (file)
index 0000000..417248a
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void noreturn (int status, ...);
+
+extern inline __attribute ((always_inline)) void
+error (int status, ...)
+{
+  if (__builtin_constant_p (status))
+    noreturn (status, __builtin_va_arg_pack ());
+}
+
+void
+f (void)
+{
+  error (1);
+}
index f575b27..7ebfbcd 100644 (file)
@@ -863,9 +863,18 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, int count_scal
                  if (TREE_CODE (*call_ptr) == WITH_SIZE_EXPR)
                    call_ptr = &TREE_OPERAND (*call_ptr, 0);
                  gcc_assert (*call_ptr == call);
-                 *call_ptr = new_call;
-                 stmt = *stmtp;
-                 update_stmt (stmt);
+                 if (call_ptr == stmtp)
+                   {
+                     bsi_replace (&copy_bsi, new_call, true);
+                     stmtp = bsi_stmt_ptr (copy_bsi);
+                     stmt = *stmtp;
+                   }
+                 else
+                   {
+                     *call_ptr = new_call;
+                     stmt = *stmtp;
+                     update_stmt (stmt);
+                   }
                }
              else if (call
                       && id->call_expr