From: Marek Polacek Date: Tue, 17 May 2016 20:00:41 +0000 (+0000) Subject: re PR ipa/71146 (error: __builtin_unreachable or __builtin_trap call with arguments) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47768df837de3d5d8e87ea4add0ef859b7b5f8f9;p=gcc.git re PR ipa/71146 (error: __builtin_unreachable or __builtin_trap call with arguments) PR ipa/71146 * tree-inline.c (expand_call_inline): Call maybe_remove_unused_call_args. * g++.dg/ipa/pr71146.C: New test. From-SVN: r236343 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b21421ceb8b..76c40aef677 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-17 Marek Polacek + + PR ipa/71146 + * tree-inline.c (expand_call_inline): Call + maybe_remove_unused_call_args. + 2016-05-17 Jim Wilson * doc/cpp.texi (__GNUC__): Major version changes are no longer rare. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb5940e2c90..3b4d72c0da8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-17 Marek Polacek + + PR ipa/71146 + * g++.dg/ipa/pr71146.C: New test. + 2016-05-17 David Malcolm * jit.dg/test-error-array-bounds.c: New test case. diff --git a/gcc/testsuite/g++.dg/ipa/pr71146.C b/gcc/testsuite/g++.dg/ipa/pr71146.C new file mode 100644 index 00000000000..b6bd64f4e8c --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr71146.C @@ -0,0 +1,29 @@ +// PR ipa/71146 +// { dg-do compile } +// { dg-options "-O3" } + +typedef enum { X } E; +struct A { + virtual void bar (); +}; +struct B { + virtual E fn (const char *, int, int *) = 0; +}; +struct C : A, B { + E fn (const char *, int, int *); + void fn2 (); + B *foo; +}; +void C::fn2 () { + if (!foo) + return; + foo->fn (0, 0, 0); +} +E +C::fn (const char *, int, int *) +{ + fn2 (); + foo = 0; + fn (0, 0, 0); + return X; +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 85ed2c2e84e..954dac30487 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4486,6 +4486,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) update_stmt (stmt); id->src_node->remove (); expand_call_inline (bb, stmt, id); + maybe_remove_unused_call_args (cfun, stmt); return true; } fn = cg_edge->callee->decl;