]>
Commit | Line | Data |
---|---|---|
74b04a01 XL |
1 | // Verifies that no_sanitize attribute prevents inlining when |
2 | // given sanitizer is enabled, but has no effect on inlining otherwise. | |
3 | // | |
f035d41b XL |
4 | // needs-sanitizer-address |
5 | // needs-sanitizer-leak | |
74b04a01 | 6 | // revisions: ASAN LSAN |
6a06907d XL |
7 | //[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=4 |
8 | //[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=4 | |
74b04a01 XL |
9 | |
10 | #![crate_type="lib"] | |
11 | #![feature(no_sanitize)] | |
12 | ||
13 | // ASAN-LABEL: define void @test | |
f035d41b | 14 | // ASAN: call {{.*}} @random_inline |
74b04a01 XL |
15 | // ASAN: } |
16 | // | |
17 | // LSAN-LABEL: define void @test | |
18 | // LSAN-NO: call | |
19 | // LSAN: } | |
20 | #[no_mangle] | |
21 | pub fn test(n: &mut u32) { | |
22 | random_inline(n); | |
23 | } | |
24 | ||
25 | #[no_sanitize(address)] | |
26 | #[inline] | |
27 | #[no_mangle] | |
28 | pub fn random_inline(n: &mut u32) { | |
29 | *n = 42; | |
30 | } |