Commit acb2399 1 parent e18716f commit acb2399 Copy full SHA for acb2399
File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments