summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs')
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
new file mode 100644
index 000000000..cf22b06d5
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
@@ -0,0 +1,9 @@
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
+#[allow(unconditional_panic)]
+fn main() {
+ let a: *const [_] = &[1, 2, 3];
+ unsafe {
+ let _b = (*a)[3];
+ }
+}