From 58047c1717785b31671bb3495ccd64926d36f0f3 Mon Sep 17 00:00:00 2001 From: aoliva Date: Mon, 15 Oct 2007 17:05:19 +0000 Subject: [PATCH] gcc/ChangeLog: 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/va-arg-pack-2.c | 17 +++++++++++++++++ gcc/tree-inline.c | 15 ++++++++++++--- 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/va-arg-pack-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2849b9..f627ef7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-10-15 Alexandre Oliva + + 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 * matrix-reorg.c (gate_matrix_reorg): Don't comment out whole diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c541b3c..7f09cdd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-10-15 Alexandre Oliva + + PR middle-end/33706 + * gcc.dg/va-arg-pack-2.c: New. + 2007-10-15 Jakub Jelinek 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 index 0000000..417248a --- /dev/null +++ b/gcc/testsuite/gcc.dg/va-arg-pack-2.c @@ -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); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index f575b27..7ebfbcd 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -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 (©_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 -- 2.7.4