From: Jakub Jelinek Date: Thu, 31 Jan 2019 08:20:45 +0000 (+0100) Subject: re PR sanitizer/89124 (__attribute__((no_sanitize_address)) interferes with __attribu... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6206a883fe7a741dbb9e09d88255a170a75950f5;p=gcc.git re PR sanitizer/89124 (__attribute__((no_sanitize_address)) interferes with __attribute__((target(xxx)))) PR sanitizer/89124 * ipa-inline.c (sanitize_attrs_match_for_inline_p): Allow inlining always_inline callees into no_sanitize_address callers. * c-c++-common/asan/pr89124.c: New test. From-SVN: r268415 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1166329e6c..a220d575600 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-31 Jakub Jelinek + + PR sanitizer/89124 + * ipa-inline.c (sanitize_attrs_match_for_inline_p): Allow inlining + always_inline callees into no_sanitize_address callers. + 2019-01-31 Richard Biener PR rtl-optimization/89115 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 2c1843aa816..4ddbfdf772c 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -264,6 +264,12 @@ sanitize_attrs_match_for_inline_p (const_tree caller, const_tree callee) if (!caller || !callee) return true; + /* Allow inlining always_inline functions into no_sanitize_address + functions. */ + if (!sanitize_flags_p (SANITIZE_ADDRESS, caller) + && lookup_attribute ("always_inline", DECL_ATTRIBUTES (callee))) + return true; + return ((sanitize_flags_p (SANITIZE_ADDRESS, caller) == sanitize_flags_p (SANITIZE_ADDRESS, callee)) && (sanitize_flags_p (SANITIZE_POINTER_COMPARE, caller) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 917c13e57a2..48f4bbddd88 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-31 Jakub Jelinek + + PR sanitizer/89124 + * c-c++-common/asan/pr89124.c: New test. + 2019-01-30 Jerry DeLisle PR fortran/52564 diff --git a/gcc/testsuite/c-c++-common/asan/pr89124.c b/gcc/testsuite/c-c++-common/asan/pr89124.c new file mode 100644 index 00000000000..c9c870b76c6 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pr89124.c @@ -0,0 +1,14 @@ +/* PR sanitizer/89124 */ +/* { dg-do compile } */ + +static int inline __attribute__ ((always_inline)) +foo (int x) +{ + return x + 1; +} + +__attribute__ ((no_sanitize_address)) int +bar (int x) +{ + return foo (x); +}