File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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+ }
1422impl ByteRepr for container {
1523 fn byte_size ( ) -> usize {
1624 16
Original file line number Diff line number Diff 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+ }
1422impl Default for pair {
1523 fn default ( ) -> Self {
1624 pair {
Original file line number Diff line number Diff 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( ) ;
Original file line number Diff line number Diff 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+ }
1422impl 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 ( ( ( {
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change 1- // panic: refcount
21#include < assert.h>
32#include < stdint.h>
43
You can’t perform that action at this time.
0 commit comments