From 26716fc717b3965a56b280f6f5f7446153457b0b Mon Sep 17 00:00:00 2001 From: ienkovich Date: Thu, 7 Jul 2016 11:45:11 +0000 Subject: gcc/ PR ipa/71624 * ipa-inline-analysis.c (compute_inline_parameters): Set local.can_change_signature to false for intrumentation thunk callees. gcc/testsuite/ PR ipa/71624 * g++.dg/pr71624.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238086 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/ipa-inline-analysis.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr71624.C | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr71624.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7cfc92cf975..75f39de42c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-07-07 Ilya Enkovich + + PR ipa/71624 + * ipa-inline-analysis.c (compute_inline_parameters): Set + local.can_change_signature to false for intrumentation + thunk callees. + 2016-07-07 Thomas Preud'homme * config/arm/arm.h (TARGET_USE_MOVT): Check MOVT/MOVW availability diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 5d6721813d8..da29d2240a4 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -3017,6 +3017,16 @@ compute_inline_parameters (struct cgraph_node *node, bool early) node->local.can_change_signature = !e; } } + /* Functions called by instrumentation thunk can't change signature + because instrumentation thunk modification is not supported. */ + if (node->local.can_change_signature) + for (e = node->callers; e; e = e->next_caller) + if (e->caller->thunk.thunk_p + && e->caller->thunk.add_pointer_bounds_args) + { + node->local.can_change_signature = false; + break; + } estimate_function_body_sizes (node, early); pop_cfun (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16eebb6bcb7..f5bf6b137b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-07 Ilya Enkovich + + PR ipa/71624 + * g++.dg/pr71624.C: New test. + 2016-07-07 Thomas Preud'homme * lib/target-supports.exp: Generate add_options_for_arm_arch_FUNC and diff --git a/gcc/testsuite/g++.dg/pr71624.C b/gcc/testsuite/g++.dg/pr71624.C new file mode 100644 index 00000000000..94a75cd4c41 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr71624.C @@ -0,0 +1,35 @@ +/* PR71624 */ +// { dg-do compile { target i?86-*-* x86_64-*-* } } +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +class c1 +{ +public: + virtual int fn1 () const; + int fn2 (const int *) const; +}; + +class c2 +{ + int fn1 (); + c1 obj; +}; + +int +c1::fn1 () const +{ + return 0; +} + +int +c1::fn2 (const int *) const +{ + return this->fn1 (); +} + +int +c2::fn1 () +{ + return obj.fn2 (0); +} + -- cgit v1.2.1