Skip to content

Commit f3e1a95

Browse files
committed
Auto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbini
[stable] Cherry-pick LLVM fix for 1.41.1 This PR cherry-picks the LLVM patch required to properly fix #69225 on 1.41.1, and adds a test to make sure the fix works. r? @ghost
2 parents ded0270 + acb2399 commit f3e1a95

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// run-fail
2+
// compile-flags: -C opt-level=3
3+
// error-pattern: index out of bounds: the len is 0 but the index is 16777216
4+
// ignore-wasm no panic or subprocess support
5+
// ignore-emscripten no panic or subprocess support
6+
7+
fn do_test(x: usize) {
8+
let mut arr = vec![vec![0u8; 3]];
9+
10+
let mut z = vec![0];
11+
for arr_ref in arr.iter_mut() {
12+
for y in 0..x {
13+
for _ in 0..1 {
14+
z.reserve_exact(x);
15+
let iterator = std::iter::repeat(0).take(x);
16+
let mut cnt = 0;
17+
iterator.for_each(|_| {
18+
z[0] = 0;
19+
cnt += 1;
20+
});
21+
let a = y * x;
22+
let b = (y + 1) * x - 1;
23+
let slice = &mut arr_ref[a..b];
24+
slice[1 << 24] += 1;
25+
}
26+
}
27+
}
28+
}
29+
30+
fn main() {
31+
do_test(1);
32+
do_test(2);
33+
}

0 commit comments

Comments
 (0)