From c7ed8938d6a62e532c89c25f54851b8c4fef1d88 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Wed, 13 Jul 2016 11:02:15 +0000 Subject: [PATCH] re PR ipa/71633 ([CHKP] internal compiler error: in inline_call) gcc/ PR ipa/71633 * ipa-inline-transform.c (inline_call): Support instrumented thunks. gcc/testsuite/ PR ipa/71633 * g++.dg/pr71633.C: New test. From-SVN: r238290 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-inline-transform.c | 6 +++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr71633.C | 28 ++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/pr71633.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f05d2b19246..03dac3322bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-13 Ilya Enkovich + + PR ipa/71633 + * ipa-inline-transform.c (inline_call): Support + instrumented thunks. + 2016-07-13 Thomas Preud'homme * config/arm/arm.h (TARGET_HAVE_CBZ): Define. diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c index 9ac1efc9192..98c7f96fbb6 100644 --- a/gcc/ipa-inline-transform.c +++ b/gcc/ipa-inline-transform.c @@ -319,10 +319,14 @@ inline_call (struct cgraph_edge *e, bool update_original, to = to->global.inlined_to; if (to->thunk.thunk_p) { + struct cgraph_node *target = to->callees->callee; if (in_lto_p) to->get_untransformed_body (); to->expand_thunk (false, true); - e = to->callees; + /* When thunk is instrumented we may have multiple callees. */ + for (e = to->callees; e && e->callee != target; e = e->next_callee) + ; + gcc_assert (e); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 239d55e7458..c21469b6b94 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-13 Ilya Enkovich + + PR ipa/71633 + * g++.dg/pr71633.C: New test. + 2016-07-13 Thomas Preud'homme * lib/target-supports.exp (check_effective_target_arm_thumb1_cbz_ok): diff --git a/gcc/testsuite/g++.dg/pr71633.C b/gcc/testsuite/g++.dg/pr71633.C new file mode 100644 index 00000000000..bb69bbb211e --- /dev/null +++ b/gcc/testsuite/g++.dg/pr71633.C @@ -0,0 +1,28 @@ +/* PR71633 */ +// { dg-do compile { target i?86-*-* x86_64-*-* } } +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +class c1 +{ + virtual void fn1 (); +}; + +class c2 +{ + virtual int *fn2 () const; +}; + +class c3 : c1, c2 +{ + int *fn2 () const; + int *fn3 (int) const; +}; + +int *c3::fn2 () const +{ +} + +int *c3::fn3 (int p) const +{ + return fn3 (p); +} -- 2.30.2