Skip to content

Commit b75dd71

Browse files
committed
rewrite msvc-opt-minsize to ui test
1 parent 3a65646 commit b75dd71

File tree

7 files changed

+31
-25
lines changed

7 files changed

+31
-25
lines changed

tests/run-make/msvc-opt-minsize/Makefile

-6
This file was deleted.

tests/run-make/msvc-opt-minsize/foo.rs

-19
This file was deleted.
File renamed without changes.

tests/ui/windows/msvc-opt-minsize.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// A previously outdated version of LLVM caused compilation failures on Windows
2+
// specifically with optimization level `z`. After the update to a more recent LLVM
3+
// version, this test checks that compilation and execution both succeed.
4+
// See https://github.com/rust-lang/rust/issues/45034
5+
6+
//@ ignore-cross-compile
7+
// Reason: the compiled binary is executed
8+
//@ only-windows
9+
// Reason: the observed bug only occurs on Windows
10+
//@ run-pass
11+
//@ compile-flags: -C opt-level=z
12+
13+
#![feature(test)]
14+
extern crate test;
15+
16+
fn foo(x: i32, y: i32) -> i64 {
17+
(x + y) as i64
18+
}
19+
20+
#[inline(never)]
21+
fn bar() {
22+
let _f = Box::new(0);
23+
// This call used to trigger an LLVM bug in opt-level z where the base
24+
// pointer gets corrupted, see issue #45034
25+
let y: fn(i32, i32) -> i64 = test::black_box(foo);
26+
test::black_box(y(1, 2));
27+
}
28+
29+
fn main() {
30+
bar();
31+
}
File renamed without changes.

0 commit comments

Comments
 (0)