Skip to content

Commit 580ac87

Browse files
committed
Update tests
1 parent 86aaf0c commit 580ac87

9 files changed

Lines changed: 58 additions & 31 deletions

‎tests/ub/out/refcount/int_to_pointer_out_of_range.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ fn main_0() -> i32 {
5151
};
5252
let u: Value<anon_0> = <Value<anon_0>>::default();
5353
(*u.borrow_mut()).p().write((arr.as_pointer() as Ptr<i32>));
54-
let rhs_0 = ((((*u.borrow()).bits().read()) as u64)
55-
.wrapping_add(((100_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64)))
56-
as u64;
57-
(*u.borrow_mut()).bits().write(rhs_0);
54+
{
55+
let rhs_0 = ((*u.borrow()).bits().read()).wrapping_add(
56+
((100_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64),
57+
);
58+
(*u.borrow_mut()).bits().write(rhs_0)
59+
};
5860
let p: Value<Ptr<i32>> = Rc::new(RefCell::new(((*u.borrow()).p().read()).clone()));
5961
return if (((((*p.borrow()).read()) == 0) as i32) != 0) {
6062
0

‎tests/ub/out/unsafe/int_to_pointer_out_of_range.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ unsafe fn main_0() -> i32 {
2626
};
2727
let mut u: anon_0 = <anon_0>::default();
2828
u.p = arr.as_mut_ptr();
29-
u.bits = ((u.bits as u64)
30-
.wrapping_add(((100_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64)))
31-
as u64;
29+
u.bits = (u.bits)
30+
.wrapping_add(((100_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64));
3231
let mut p: *mut i32 = u.p;
3332
return if ((((*p) == (0)) as i32) != 0) { 0 } else { 1 };
3433
}

‎tests/unit/out/refcount/opaque_forward_decl.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ pub struct container {
1111
pub p: Value<Ptr<opaque>>,
1212
pub x: Value<i32>,
1313
}
14+
impl Clone for container {
15+
fn clone(&self) -> Self {
16+
Self {
17+
p: Rc::new(RefCell::new((*self.p.borrow()).clone())),
18+
x: Rc::new(RefCell::new((*self.x.borrow()).clone())),
19+
}
20+
}
21+
}
1422
impl ByteRepr for container {
1523
fn byte_size() -> usize {
1624
16

‎tests/unit/out/refcount/struct_member_array_adjacency.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ pub struct pair {
1111
pub a: Value<Box<[i32]>>,
1212
pub b: Value<Box<[i32]>>,
1313
}
14+
impl Clone for pair {
15+
fn clone(&self) -> Self {
16+
Self {
17+
a: Rc::new(RefCell::new((*self.a.borrow()).clone())),
18+
b: Rc::new(RefCell::new((*self.b.borrow()).clone())),
19+
}
20+
}
21+
}
1422
impl Default for pair {
1523
fn default() -> Self {
1624
pair {

‎tests/unit/out/refcount/union_pointer_int_roundtrip.rs‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ fn main_0() -> i32 {
5353
(*u.borrow_mut())
5454
.p()
5555
.write(((arr.as_pointer() as Ptr<i32>).offset(1)));
56-
let rhs_0 = ((((*u.borrow()).bits().read()) as u64)
57-
.wrapping_add(((2_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64)))
58-
as u64;
59-
(*u.borrow_mut()).bits().write(rhs_0);
56+
{
57+
let rhs_0 = ((*u.borrow()).bits().read())
58+
.wrapping_add(((2_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64));
59+
(*u.borrow_mut()).bits().write(rhs_0)
60+
};
6061
let q: Value<Ptr<i32>> = Rc::new(RefCell::new(((*u.borrow()).p().read()).clone()));
6162
assert!((((((*q.borrow()).read()) == 40) as i32) != 0));
6263
assert!(
@@ -66,10 +67,11 @@ fn main_0() -> i32 {
6667
}) as i32)
6768
!= 0)
6869
);
69-
let rhs_0 = ((((*u.borrow()).bits().read()) as u64)
70-
.wrapping_sub(((3_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64)))
71-
as u64;
72-
(*u.borrow_mut()).bits().write(rhs_0);
70+
{
71+
let rhs_0 = ((*u.borrow()).bits().read())
72+
.wrapping_sub(((3_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64));
73+
(*u.borrow_mut()).bits().write(rhs_0)
74+
};
7375
assert!(
7476
((({
7577
let _lhs = ((*u.borrow()).p().read()).clone();

‎tests/unit/out/refcount/union_struct_pointer_roundtrip.rs‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ pub struct pair {
1111
pub x: Value<i32>,
1212
pub y: Value<i32>,
1313
}
14+
impl Clone for pair {
15+
fn clone(&self) -> Self {
16+
Self {
17+
x: Rc::new(RefCell::new((*self.x.borrow()).clone())),
18+
y: Rc::new(RefCell::new((*self.y.borrow()).clone())),
19+
}
20+
}
21+
}
1422
impl ByteRepr for pair {
1523
fn byte_size() -> usize {
1624
8
@@ -87,8 +95,10 @@ fn main_0() -> i32 {
8795
}) as i32)
8896
!= 0)
8997
);
90-
let rhs_0 = ((((*u.borrow()).bits().read()) as u64).wrapping_add((8usize as u64))) as u64;
91-
(*u.borrow_mut()).bits().write(rhs_0);
98+
{
99+
let rhs_0 = ((*u.borrow()).bits().read()).wrapping_add((8usize as u64));
100+
(*u.borrow_mut()).bits().write(rhs_0)
101+
};
92102
assert!(((((*(*((*u.borrow()).p().read()).upgrade().deref()).x.borrow()) == 30) as i32) != 0));
93103
assert!(
94104
((({
@@ -97,9 +107,11 @@ fn main_0() -> i32 {
97107
}) as i32)
98108
!= 0)
99109
);
100-
let rhs_0 = ((((*u.borrow()).bits().read()) as u64)
101-
.wrapping_sub(((2_usize).wrapping_mul((8usize as usize)) as u64))) as u64;
102-
(*u.borrow_mut()).bits().write(rhs_0);
110+
{
111+
let rhs_0 = ((*u.borrow()).bits().read())
112+
.wrapping_sub(((2_usize).wrapping_mul((8usize as usize)) as u64));
113+
(*u.borrow_mut()).bits().write(rhs_0)
114+
};
103115
assert!(((((*(*((*u.borrow()).p().read()).upgrade().deref()).x.borrow()) == 10) as i32) != 0));
104116
assert!(
105117
((({

‎tests/unit/out/unsafe/union_pointer_int_roundtrip.rs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ unsafe fn main_0() -> i32 {
2626
};
2727
let mut u: anon_0 = <anon_0>::default();
2828
u.p = (&mut arr[(1) as usize] as *mut i32);
29-
u.bits = ((u.bits as u64)
30-
.wrapping_add(((2_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64)))
31-
as u64;
29+
u.bits = (u.bits)
30+
.wrapping_add(((2_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64));
3231
let mut q: *mut i32 = u.p;
3332
assert!(((((*q) == (40)) as i32) != 0));
3433
assert!(((((q) == (&mut arr[(3) as usize] as *mut i32)) as i32) != 0));
35-
u.bits = ((u.bits as u64)
36-
.wrapping_sub(((3_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64)))
37-
as u64;
34+
u.bits = (u.bits)
35+
.wrapping_sub(((3_usize).wrapping_mul((::std::mem::size_of::<i32>() as usize)) as u64));
3836
assert!(((((u.p) == (&mut arr[(0) as usize] as *mut i32)) as i32) != 0));
3937
assert!(((((*u.p) == (10)) as i32) != 0));
4038
u.p = arr.as_mut_ptr().offset((4) as isize);

‎tests/unit/out/unsafe/union_struct_pointer_roundtrip.rs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ unsafe fn main_0() -> i32 {
3838
let mut q: *mut pair = u.p;
3939
assert!((((((*q).x) == (20)) as i32) != 0));
4040
assert!(((((q) == (&mut arr[(1) as usize] as *mut pair)) as i32) != 0));
41-
u.bits = ((u.bits as u64).wrapping_add((::std::mem::size_of::<pair>() as u64))) as u64;
41+
u.bits = (u.bits).wrapping_add((::std::mem::size_of::<pair>() as u64));
4242
assert!((((((*u.p).x) == (30)) as i32) != 0));
4343
assert!(((((u.p) == (&mut arr[(2) as usize] as *mut pair)) as i32) != 0));
44-
u.bits = ((u.bits as u64)
45-
.wrapping_sub(((2_usize).wrapping_mul((::std::mem::size_of::<pair>() as usize)) as u64)))
46-
as u64;
44+
u.bits = (u.bits)
45+
.wrapping_sub(((2_usize).wrapping_mul((::std::mem::size_of::<pair>() as usize)) as u64));
4746
assert!((((((*u.p).x) == (10)) as i32) != 0));
4847
assert!(((((u.p) == (&mut arr[(0) as usize] as *mut pair)) as i32) != 0));
4948
return 0;

‎tests/unit/unconst.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// panic: refcount
21
#include <assert.h>
32
#include <stdint.h>
43

0 commit comments

Comments
 (0)