2020-03-02 18:00:00 -06:00
|
|
|
// Regression test for sanitizer function instrumentation passes not
|
|
|
|
// being run when compiling with new LLVM pass manager and ThinLTO.
|
2020-03-06 05:13:55 -06:00
|
|
|
// Note: The issue occurred only on non-zero opt-level.
|
2020-03-02 18:00:00 -06:00
|
|
|
//
|
|
|
|
// needs-sanitizer-support
|
2020-06-04 19:00:00 -05:00
|
|
|
// needs-sanitizer-address
|
2020-03-02 18:00:00 -06:00
|
|
|
//
|
|
|
|
// no-prefer-dynamic
|
|
|
|
// revisions: opt0 opt1
|
2022-09-16 18:37:17 -05:00
|
|
|
// compile-flags: -Zsanitizer=address -Clto=thin
|
2020-03-02 18:00:00 -06:00
|
|
|
//[opt0]compile-flags: -Copt-level=0
|
|
|
|
//[opt1]compile-flags: -Copt-level=1
|
|
|
|
// run-fail
|
|
|
|
// error-pattern: ERROR: AddressSanitizer: stack-use-after-scope
|
|
|
|
|
|
|
|
static mut P: *mut usize = std::ptr::null_mut();
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
{
|
|
|
|
let mut x = 0;
|
|
|
|
P = &mut x;
|
|
|
|
}
|
|
|
|
std::ptr::write_volatile(P, 123);
|
|
|
|
}
|
|
|
|
}
|