From: jakub Date: Mon, 8 Sep 2008 21:31:36 +0000 (+0000) Subject: PR middle-end/37393 X-Git-Tag: upstream/4.9.2~39802 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8b26b0296e2b4c8d5e19f912cbea67205b79eba;p=platform%2Fupstream%2Flinaro-gcc.git PR middle-end/37393 * tree-inline.c (copy_bb): When replacing a gimple_call_va_arg_pack_p call stmt by new_call, clear gimple_bb on stmt after gsi_replace. * g++.dg/tree-ssa/pr37393.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140123 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60ff6e9..d5c28ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-09-08 Jakub Jelinek + PR middle-end/37393 + * tree-inline.c (copy_bb): When replacing a gimple_call_va_arg_pack_p + call stmt by new_call, clear gimple_bb on stmt after gsi_replace. + PR middle-end/37414 * predict.c (optimize_function_for_size_p): Don't segfault if FUN is NULL. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f5aec00..d8e5716 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2008-09-08 Jakub Jelinek + PR middle-end/37393 + * g++.dg/tree-ssa/pr37393.C: New test. + PR middle-end/37414 * g++.dg/opt/init2.C: New test. diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr37393.C b/gcc/testsuite/g++.dg/tree-ssa/pr37393.C new file mode 100644 index 0000000..2f9281c --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr37393.C @@ -0,0 +1,27 @@ +// PR middle-end/37393 +// { dg-do compile } +// { dg-options "-O2" } + +struct A +{ + ~A (); + bool foo () const; +}; + +extern "C" +{ + extern void bar (const char *, ...) __attribute__ ((noreturn)); + extern inline __attribute__ ((always_inline, gnu_inline, artificial)) void + baz (const char *fmt, ...) + { + bar (fmt, __builtin_va_arg_pack ()); + } +}; + +void +test () +{ + A a; + if (a.foo ()) + baz ("foo"); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 8b603f0..d083a54 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1331,6 +1331,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, gimple_call_set_lhs (new_call, gimple_call_lhs (stmt)); gsi_replace (©_gsi, new_call, false); + gimple_set_bb (stmt, NULL); stmt = new_call; } else if (is_gimple_call (stmt)