We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff991d6 commit cd5f228Copy full SHA for cd5f228
src/test/codegen/integer-overflow.rs
@@ -0,0 +1,26 @@
1
+// no-system-llvm
2
+// compile-flags: -O -C overflow-checks=on
3
+
4
+#![crate_type = "lib"]
5
6
7
+pub struct S1<'a> {
8
+ data: &'a [u8],
9
+ position: usize,
10
+}
11
12
+// CHECK-LABEL: @slice_no_index_order
13
+#[no_mangle]
14
+pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] {
15
+ // CHECK-NOT: slice_index_order_fail
16
+ let d = &s.data[s.position..s.position+n];
17
+ s.position += n;
18
+ return d;
19
20
21
+// CHECK-LABEL: @test_check
22
23
+pub fn test_check<'a>(s: &'a mut S1, x: usize, y: usize) -> &'a [u8] {
24
+ // CHECK: slice_index_order_fail
25
+ &s.data[x..y]
26
0 commit comments