Skip to content

Commit

Permalink
inliner: Check for no_sanitize attribute compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed Sep 4, 2020
1 parent cbc396f commit 326b772
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions compiler/rustc_mir/src/transform/inline.rs
Expand Up @@ -251,9 +251,12 @@ impl Inliner<'tcx> {
return false;
}

// Avoid inlining functions marked as no_sanitize if sanitizer is enabled,
// since instrumentation might be enabled and performed on the caller.
if self.tcx.sess.opts.debugging_opts.sanitizer.intersects(codegen_fn_attrs.no_sanitize) {
let self_no_sanitize =
self.codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer;
let callee_no_sanitize =
codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer;
if self_no_sanitize != callee_no_sanitize {
debug!("`callee has incompatible no_sanitize attribute - not inlining");
return false;
}

Expand Down

0 comments on commit 326b772

Please sign in to comment.