about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-03 21:10:31 +0000
committerbors <bors@rust-lang.org>2024-07-03 21:10:31 +0000
commitaa1d4f6826de006b02fed31a718ce4f674203721 (patch)
tree15d63286e47d03552d14d22acb31bb3f47ded163 /tests/ui
parent2b90614e94cfb400820cfc10fe63b0db74f9e67a (diff)
parent45313a6ca038995bc3a0cc952fac94102d00f60c (diff)
downloadrust-aa1d4f6826de006b02fed31a718ce4f674203721.tar.gz
rust-aa1d4f6826de006b02fed31a718ce4f674203721.zip
Auto merge of #127044 - Oneirical:fantestic-journey, r=Kobzol,jieyouxu
Migrate `dylib-chain`, `rlib-chain`, `issue-47384`, `msvc-opt-minsize` and `test-harness` `run-make` tests to ui/rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
try-job: aarch64-apple
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/msvc-opt-minsize.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/msvc-opt-minsize.rs b/tests/ui/msvc-opt-minsize.rs
new file mode 100644
index 00000000000..c1be168a05d
--- /dev/null
+++ b/tests/ui/msvc-opt-minsize.rs
@@ -0,0 +1,31 @@
+// A previously outdated version of LLVM caused compilation failures on Windows
+// specifically with optimization level `z`. After the update to a more recent LLVM
+// version, this test checks that compilation and execution both succeed.
+// See https://github.com/rust-lang/rust/issues/45034
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+//@ only-windows
+// Reason: the observed bug only occurs on Windows
+//@ run-pass
+//@ compile-flags: -C opt-level=z
+
+#![feature(test)]
+extern crate test;
+
+fn foo(x: i32, y: i32) -> i64 {
+    (x + y) as i64
+}
+
+#[inline(never)]
+fn bar() {
+    let _f = Box::new(0);
+    // This call used to trigger an LLVM bug in opt-level z where the base
+    // pointer gets corrupted, see issue #45034
+    let y: fn(i32, i32) -> i64 = test::black_box(foo);
+    test::black_box(y(1, 2));
+}
+
+fn main() {
+    bar();
+}