Never inline when no_sanitize attributes differ
The inliner looks if a sanitizer is enabled before considering `no_sanitize` attribute as possible source of incompatibility. The MIR inlining could happen in a crate with sanitizer disabled, but code generation in a crate with sanitizer enabled, thus the attribute would be incorrectly ignored. To avoid the issue never inline functions with different `no_sanitize` attributes.
This commit is contained in:
@@ -218,11 +218,7 @@ impl Inliner<'tcx> {
|
||||
return false;
|
||||
}
|
||||
|
||||
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 {
|
||||
if self.codegen_fn_attrs.no_sanitize != codegen_fn_attrs.no_sanitize {
|
||||
debug!("`callee has incompatible no_sanitize attribute - not inlining");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user