@@ -658,6 +658,111 @@ pub fn borrow_in_condition_and_in_body_30(x: i32) -> i32 {
658658 } ) ;
659659 panic ! ( "ub: non-void function does not return a value" )
660660}
661+ pub fn for_in_switch_break_31 ( n : i32 ) -> i32 {
662+ let n: Value < i32 > = Rc :: new ( RefCell :: new ( n) ) ;
663+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
664+ ' switch: {
665+ let __match_cond = ( * n. borrow ( ) ) ;
666+ match __match_cond {
667+ v if v == 0 => {
668+ let i: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
669+ ' loop_: while ( ( * i. borrow ( ) ) < 10 ) {
670+ if ( ( * i. borrow ( ) ) == 3 ) {
671+ break ;
672+ }
673+ ( * r. borrow_mut ( ) ) += ( * i. borrow ( ) ) ;
674+ ( * i. borrow_mut ( ) ) . prefix_inc ( ) ;
675+ }
676+ ( * r. borrow_mut ( ) ) += 100 ;
677+ break ' switch;
678+ }
679+ _ => {
680+ ( * r. borrow_mut ( ) ) = -1_i32 ;
681+ break ' switch;
682+ }
683+ }
684+ } ;
685+ return ( * r. borrow ( ) ) ;
686+ }
687+ pub fn for_in_switch_continue_32 ( n : i32 ) -> i32 {
688+ let n: Value < i32 > = Rc :: new ( RefCell :: new ( n) ) ;
689+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
690+ ' switch: {
691+ let __match_cond = ( * n. borrow ( ) ) ;
692+ match __match_cond {
693+ v if v == 0 => {
694+ let i: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
695+ ' loop_: while ( ( * i. borrow ( ) ) < 5 ) {
696+ if ( ( ( * i. borrow ( ) ) % 2 ) == 0 ) {
697+ ( * i. borrow_mut ( ) ) . prefix_inc ( ) ;
698+ continue ' loop_;
699+ }
700+ ( * r. borrow_mut ( ) ) += ( * i. borrow ( ) ) ;
701+ ( * i. borrow_mut ( ) ) . prefix_inc ( ) ;
702+ }
703+ break ' switch;
704+ }
705+ _ => {
706+ ( * r. borrow_mut ( ) ) = -1_i32 ;
707+ break ' switch;
708+ }
709+ }
710+ } ;
711+ return ( * r. borrow ( ) ) ;
712+ }
713+ pub fn while_in_switch_break_33 ( n : i32 ) -> i32 {
714+ let n: Value < i32 > = Rc :: new ( RefCell :: new ( n) ) ;
715+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
716+ switch ! ( match ( * n. borrow( ) ) {
717+ v if v == 0 => {
718+ let i: Value <i32 > = Rc :: new( RefCell :: new( 0 ) ) ;
719+ ' loop_: while ( ( * i. borrow( ) ) < 10 ) {
720+ if ( ( * i. borrow( ) ) == 4 ) {
721+ break ;
722+ }
723+ ( * r. borrow_mut( ) ) += ( * i. borrow( ) ) ;
724+ ( * i. borrow_mut( ) ) . prefix_inc( ) ;
725+ }
726+ ( * r. borrow_mut( ) ) += 1000 ;
727+ break ;
728+ }
729+ _ => {
730+ ( * r. borrow_mut( ) ) = -1_i32 ;
731+ break ;
732+ }
733+ } ) ;
734+ return ( * r. borrow ( ) ) ;
735+ }
736+ pub fn for_switch_for_break_34 ( n : i32 ) -> i32 {
737+ let n: Value < i32 > = Rc :: new ( RefCell :: new ( n) ) ;
738+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
739+ let i: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
740+ ' loop_: while ( ( * i. borrow ( ) ) < ( * n. borrow ( ) ) ) {
741+ ' switch: {
742+ let __match_cond = ( * i. borrow ( ) ) ;
743+ match __match_cond {
744+ v if v == 1 => {
745+ let j: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
746+ ' loop_: while ( ( * j. borrow ( ) ) < 10 ) {
747+ if ( ( * j. borrow ( ) ) == 2 ) {
748+ break ;
749+ }
750+ ( * r. borrow_mut ( ) ) += 1 ;
751+ ( * j. borrow_mut ( ) ) . prefix_inc ( ) ;
752+ }
753+ ( * r. borrow_mut ( ) ) += 100 ;
754+ break ' switch;
755+ }
756+ _ => {
757+ ( * r. borrow_mut ( ) ) += 10 ;
758+ break ' switch;
759+ }
760+ }
761+ } ;
762+ ( * i. borrow_mut ( ) ) . prefix_inc ( ) ;
763+ }
764+ return ( * r. borrow ( ) ) ;
765+ }
661766pub fn main ( ) {
662767 std:: process:: exit ( main_0 ( ) ) ;
663768}
@@ -1217,5 +1322,47 @@ fn main_0() -> i32 {
12171322 borrow_in_condition_and_in_body_30( _x)
12181323 } ) == 2 )
12191324 ) ;
1325+ assert ! (
1326+ ( ( {
1327+ let _n: i32 = 0 ;
1328+ for_in_switch_break_31( _n)
1329+ } ) == 103 )
1330+ ) ;
1331+ assert ! (
1332+ ( ( {
1333+ let _n: i32 = 99 ;
1334+ for_in_switch_break_31( _n)
1335+ } ) == -1_i32 )
1336+ ) ;
1337+ assert ! (
1338+ ( ( {
1339+ let _n: i32 = 0 ;
1340+ for_in_switch_continue_32( _n)
1341+ } ) == 4 )
1342+ ) ;
1343+ assert ! (
1344+ ( ( {
1345+ let _n: i32 = 99 ;
1346+ for_in_switch_continue_32( _n)
1347+ } ) == -1_i32 )
1348+ ) ;
1349+ assert ! (
1350+ ( ( {
1351+ let _n: i32 = 0 ;
1352+ while_in_switch_break_33( _n)
1353+ } ) == 1006 )
1354+ ) ;
1355+ assert ! (
1356+ ( ( {
1357+ let _n: i32 = 99 ;
1358+ while_in_switch_break_33( _n)
1359+ } ) == -1_i32 )
1360+ ) ;
1361+ assert ! (
1362+ ( ( {
1363+ let _n: i32 = 3 ;
1364+ for_switch_for_break_34( _n)
1365+ } ) == 122 )
1366+ ) ;
12201367 return 0 ;
12211368}
0 commit comments