Skip to content

Commit 797ebf5

Browse files
committed
add tests
1 parent 44c6999 commit 797ebf5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/ui/const_prop/issue-102403.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// run-pass
2+
// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
3+
4+
// Regression test for a broken MIR optimization.
5+
pub fn f() -> f64 {
6+
std::hint::black_box(-1.0) % std::hint::black_box(-1.0)
7+
}
8+
9+
pub fn g() -> f64 {
10+
-1.0 % -1.0
11+
}
12+
13+
pub fn main() {
14+
assert_eq!(f().signum(), g().signum());
15+
}

tests/ui/const_prop/issue-113407.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// run-pass
2+
// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
3+
4+
// Regression test for a broken MIR optimization.
5+
pub fn main() {
6+
let f = f64::from_bits(0x19873cc2) as f32;
7+
assert_eq!(f.to_bits(), 0);
8+
}

0 commit comments

Comments
 (0)