From c291690eb5bfc51a502854b0ab3b9486718a1661 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Thu, 29 Jan 2015 11:03:02 +0000 Subject: [PATCH] re PR middle-end/64805 (Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx) gcc/ PR middle-end/64805 * ipa-inline.c (early_inliner): Rebuild IPA_REF_CHKP reference to avoid error in cgraph node verification. gcc/testsuite/ PR middle-end/64805 * gcc.target/i386/pr64805.c: New. From-SVN: r220240 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-inline.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr64805.c | 22 ++++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr64805.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 81a4311ef7d..7afc30186bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-29 Ilya Enkovich + + PR middle-end/64805 + * ipa-inline.c (early_inliner): Rebuild IPA_REF_CHKP reference + to avoid error in cgraph node verification. + 2015-01-29 Marek Polacek * doc/standards.texi: Reflect that the default for C is gnu11. diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index f91a6a53b44..be228907400 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -2506,6 +2506,13 @@ early_inliner (function *fun) #endif node->remove_all_references (); + /* Rebuild this reference because it dosn't depend on + function's body and it's required to pass cgraph_node + verification. */ + if (node->instrumented_version + && !node->instrumentation_clone) + node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL); + /* Even when not optimizing or not inlining inline always-inline functions. */ inlined = inline_always_inline_functions (node); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 729f386011a..df9f025cc02 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-29 Ilya Enkovich + + PR middle-end/64805 + * gcc.target/i386/pr64805.c: New. + 2015-01-29 Rainer Orth * gcc.dg/guality/guality.h (main): Add argv[0] to diff --git a/gcc/testsuite/gcc.target/i386/pr64805.c b/gcc/testsuite/gcc.target/i386/pr64805.c new file mode 100644 index 00000000000..8ba0a972208 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr64805.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mpx } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +#include + +static inline void __attribute ((always_inline)) functionA(void) +{ + return; +} + +static inline void __attribute ((always_inline)) functionB(void) +{ + functionA(); +} + +int test(void) +{ + functionB(); + + return 0; +} -- 2.30.2