Skip to content

Commit de858e7

Browse files
miri: Move patterns for simd tests
It isn't clear to me why these error patterns do not trigger, but I am not going to waste time analyzing bugs in compiletest.
1 parent 4499daa commit de858e7

File tree

6 files changed

+17
-35
lines changed

6 files changed

+17
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
//@error-in-other-file: cannot be represented in target type `i32`
21
#![feature(portable_simd)]
32
use std::simd::*;
43

54
fn main() {
65
unsafe {
7-
let _x: i32x2 = f32x2::from_array([f32::MAX, f32::MIN]).to_int_unchecked();
6+
let _x: i32x2 = f32x2::from_array([f32::MAX, f32::MIN]).to_int_unchecked(); //~ERROR: cannot be represented in target type `i32`
87
}
98
}

src/tools/miri/tests/fail/intrinsics/simd-float-to-int.stderr

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
error: Undefined Behavior: `float_to_int_unchecked` intrinsic called on 3.40282347E+38 which cannot be represented in target type `i32`
2-
--> RUSTLIB/core/src/../../portable-simd/crates/core_simd/src/vector.rs:LL:CC
2+
--> $DIR/simd-float-to-int.rs:LL:CC
33
|
4-
LL | unsafe { intrinsics::simd_cast(self) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `float_to_int_unchecked` intrinsic called on 3.40282347E+38 which cannot be represented in target type `i32`
4+
LL | let _x: i32x2 = f32x2::from_array([f32::MAX, f32::MIN]).to_int_unchecked();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `float_to_int_unchecked` intrinsic called on 3.40282347E+38 which cannot be represented in target type `i32`
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::simd::Simd::<f32, 2>::to_int_unchecked::<i32>` at RUSTLIB/core/src/../../portable-simd/crates/core_simd/src/vector.rs:LL:CC
11-
note: inside `main`
12-
--> $DIR/simd-float-to-int.rs:LL:CC
13-
|
14-
LL | let _x: i32x2 = f32x2::from_array([f32::MAX, f32::MIN]).to_int_unchecked();
15-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10+
= note: inside `main` at $DIR/simd-float-to-int.rs:LL:CC
1611

1712
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1813

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
//@error-in-other-file: pointer to 1 byte starting at offset 9 is out-of-bounds
21
#![feature(portable_simd)]
32
use std::simd::*;
43

54
fn main() {
65
unsafe {
76
let vec: &[i8] = &[10, 11, 12, 13, 14, 15, 16, 17, 18];
87
let idxs = Simd::from_array([9, 3, 0, 17]);
9-
let _result = Simd::gather_select_unchecked(&vec, Mask::splat(true), idxs, Simd::splat(0));
8+
let _result = Simd::gather_select_unchecked(&vec, Mask::splat(true), idxs, Simd::splat(0)); //~ERROR: pointer to 1 byte starting at offset 9 is out-of-bounds
109
}
1110
}

src/tools/miri/tests/fail/intrinsics/simd-gather.stderr

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
error: Undefined Behavior: dereferencing pointer failed: ALLOC has size 9, so pointer to 1 byte starting at offset 9 is out-of-bounds
2-
--> RUSTLIB/core/src/../../portable-simd/crates/core_simd/src/vector.rs:LL:CC
2+
--> $DIR/simd-gather.rs:LL:CC
33
|
4-
LL | unsafe { intrinsics::simd_gather(or, ptrs, enable.to_int()) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: ALLOC has size 9, so pointer to 1 byte starting at offset 9 is out-of-bounds
4+
LL | let _result = Simd::gather_select_unchecked(&vec, Mask::splat(true), idxs, Simd::splat(0));
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: ALLOC has size 9, so pointer to 1 byte starting at offset 9 is out-of-bounds
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::simd::Simd::<i8, 4>::gather_select_unchecked` at RUSTLIB/core/src/../../portable-simd/crates/core_simd/src/vector.rs:LL:CC
11-
note: inside `main`
12-
--> $DIR/simd-gather.rs:LL:CC
13-
|
14-
LL | let _result = Simd::gather_select_unchecked(&vec, Mask::splat(true), idxs, Simd::splat(0));
15-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10+
= note: inside `main` at $DIR/simd-gather.rs:LL:CC
1611

1712
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1813

src/tools/miri/tests/fail/intrinsics/simd-scatter.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
//@error-in-other-file: pointer to 1 byte starting at offset 9 is out-of-bounds
21
#![feature(portable_simd)]
32
use std::simd::*;
43

54
fn main() {
65
unsafe {
76
let mut vec: Vec<i8> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
87
let idxs = Simd::from_array([9, 3, 0, 17]);
9-
Simd::from_array([-27, 82, -41, 124]).scatter_select_unchecked(
8+
Simd::from_array([-27, 82, -41, 124]).scatter_select_unchecked( //~ERROR: pointer to 1 byte starting at offset 9 is out-of-bounds
109
&mut vec,
1110
Mask::splat(true),
1211
idxs,

src/tools/miri/tests/fail/intrinsics/simd-scatter.stderr

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
error: Undefined Behavior: dereferencing pointer failed: ALLOC has size 9, so pointer to 1 byte starting at offset 9 is out-of-bounds
2-
--> RUSTLIB/core/src/../../portable-simd/crates/core_simd/src/vector.rs:LL:CC
3-
|
4-
LL | intrinsics::simd_scatter(self, ptrs, enable.to_int())
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: ALLOC has size 9, so pointer to 1 byte starting at offset 9 is out-of-bounds
6-
|
7-
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8-
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9-
= note: BACKTRACE:
10-
= note: inside `std::simd::Simd::<i8, 4>::scatter_select_unchecked` at RUSTLIB/core/src/../../portable-simd/crates/core_simd/src/vector.rs:LL:CC
11-
note: inside `main`
122
--> $DIR/simd-scatter.rs:LL:CC
133
|
144
LL | / Simd::from_array([-27, 82, -41, 124]).scatter_select_unchecked(
155
LL | | &mut vec,
166
LL | | Mask::splat(true),
177
LL | | idxs,
188
LL | | );
19-
| |_________^
9+
| |_________^ dereferencing pointer failed: ALLOC has size 9, so pointer to 1 byte starting at offset 9 is out-of-bounds
10+
|
11+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
12+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
13+
= note: BACKTRACE:
14+
= note: inside `main` at $DIR/simd-scatter.rs:LL:CC
2015

2116
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
2217

0 commit comments

Comments
 (0)