]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/sanitizer-no-sanitize-inlining.rs
Rollup merge of #69106 - RReverser:wasi-fs-copy, r=KodrAus
[rust.git] / src / test / codegen / sanitizer-no-sanitize-inlining.rs
1 // Verifies that no_sanitize attribute prevents inlining when
2 // given sanitizer is enabled, but has no effect on inlining otherwise.
3 //
4 // needs-sanitizer-support
5 // only-x86_64
6 //
7 // revisions: ASAN LSAN
8 //
9 //[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=3
10 //[LSAN] compile-flags: -Zsanitizer=leak    -C opt-level=3 -Z mir-opt-level=3
11
12 #![crate_type="lib"]
13 #![feature(no_sanitize)]
14
15 // ASAN-LABEL: define void @test
16 // ASAN:         tail call fastcc void @random_inline
17 // ASAN:       }
18 //
19 // LSAN-LABEL: define void @test
20 // LSAN-NO:      call
21 // LSAN:       }
22 #[no_mangle]
23 pub fn test(n: &mut u32) {
24     random_inline(n);
25 }
26
27 #[no_sanitize(address)]
28 #[inline]
29 #[no_mangle]
30 pub fn random_inline(n: &mut u32) {
31     *n = 42;
32 }