summaryrefslogtreecommitdiffstats
path: root/src/test/ui/sanitize/new-llvm-pass-manager-thin-lto.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/sanitize/new-llvm-pass-manager-thin-lto.rs')
-rw-r--r--src/test/ui/sanitize/new-llvm-pass-manager-thin-lto.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/sanitize/new-llvm-pass-manager-thin-lto.rs b/src/test/ui/sanitize/new-llvm-pass-manager-thin-lto.rs
new file mode 100644
index 000000000..1542c7f31
--- /dev/null
+++ b/src/test/ui/sanitize/new-llvm-pass-manager-thin-lto.rs
@@ -0,0 +1,26 @@
+// Regression test for sanitizer function instrumentation passes not
+// being run when compiling with new LLVM pass manager and ThinLTO.
+// Note: The issue occurred only on non-zero opt-level.
+//
+// needs-sanitizer-support
+// needs-sanitizer-address
+//
+// no-prefer-dynamic
+// revisions: opt0 opt1
+// compile-flags: -Znew-llvm-pass-manager=yes -Zsanitizer=address -Clto=thin
+//[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);
+ }
+}