GCC Bugzilla – Attachment 31522 Details for
Bug 59600
no_sanitize_address mishandled when function is inlined
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch which inlines based on caller/callee attribute match
asan_inline_fix_3.diff (text/plain), 1.93 KB, created by
Yury Gribov
on 2013-12-27 05:07:23 UTC
(
hide
)
Description:
Patch which inlines based on caller/callee attribute match
Filename:
MIME Type:
Creator:
Yury Gribov
Created:
2013-12-27 05:07:23 UTC
Size:
1.93 KB
patch
obsolete
>diff --git a/gcc/cif-code.def b/gcc/cif-code.def >index be4af6a..1d83ca3 100644 >--- a/gcc/cif-code.def >+++ b/gcc/cif-code.def >@@ -109,3 +109,6 @@ DEFCIFCODE(OPTIMIZATION_MISMATCH, N_("optimization level attribute mismatch")) > > /* We can't inline because the callee refers to comdat-local symbols. */ > DEFCIFCODE(USES_COMDAT_LOCAL, N_("callee refers to comdat-local symbols")) >+ >+/* We can't inline because of mismatched options. */ >+DEFCIFCODE(OPTION_MISMATCH, N_("option mismatch")) >diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c >index f6a26a8..ca4bc6e 100644 >--- a/gcc/ipa-inline.c >+++ b/gcc/ipa-inline.c >@@ -234,7 +234,25 @@ report_inline_failed_reason (struct cgraph_edge *e) > } > } > >-/* Decide if we can inline the edge and possibly update >+ /* Decide whether sanitizer-related attributes allow inlining. */ >+ >+static bool >+sanitize_attrs_match_for_inline_p (const_tree caller, const_tree callee) >+{ >+ /* Don't care if sanitizer is disabled */ >+ if (!(flag_sanitize & SANITIZE_ADDRESS)) >+ return true; >+ >+ if (!caller || !callee) >+ return true; >+ >+ return lookup_attribute ("no_sanitize_address", >+ DECL_ATTRIBUTES (caller)) == >+ lookup_attribute ("no_sanitize_address", >+ DECL_ATTRIBUTES (callee)); >+} >+ >+ /* Decide if we can inline the edge and possibly update > inline_failed reason. > We check whether inlining is possible at all and whether > caller growth limits allow doing so. >@@ -327,6 +345,12 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, > e->inline_failed = CIF_TARGET_OPTION_MISMATCH; > inlinable = false; > } >+ /* Don't inline a function with mismatched sanitization attributes. */ >+ else if (!sanitize_attrs_match_for_inline_p (e->caller->decl, callee->decl)) >+ { >+ e->inline_failed = CIF_OPTION_MISMATCH; >+ inlinable = false; >+ } > /* Check if caller growth allows the inlining. */ > else if (!DECL_DISREGARD_INLINE_LIMITS (callee->decl) > && !disregard_limits
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59600
:
31514
|
31515
|
31516
| 31522