mirror of
				https://github.com/ton-blockchain/ton
				synced 2025-03-09 15:40:10 +00:00 
			
		
		
		
	* FunC: enable asserts in Release * FunC: Fix analyzing infinite loops * FunC: Allow catch with one tensor argument * FunC: Fix try/catch stack corruption --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
		
			
				
	
	
		
			109 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| int foo(int x) method_id(11) {
 | |
|   try {
 | |
|     if (x == 7) {
 | |
|       throw(44);
 | |
|     }
 | |
|     return x;
 | |
|   } catch (_, _) {
 | |
|     return 2;
 | |
|   }
 | |
| }
 | |
| 
 | |
| int foo_inline(int x) inline method_id(12) {
 | |
|   try {
 | |
|     if (x == 7) {
 | |
|       throw(44);
 | |
|     }
 | |
|     return x;
 | |
|   } catch (_, _) {
 | |
|     return 2;
 | |
|   }
 | |
| }
 | |
| 
 | |
| int foo_inlineref(int x) inline_ref method_id(13) {
 | |
|   try {
 | |
|     if (x == 7) {
 | |
|       throw(44);
 | |
|     }
 | |
|     return x;
 | |
|   } catch (_, _) {
 | |
|     return 2;
 | |
|   }
 | |
| }
 | |
| 
 | |
| int test(int x, int y, int z) method_id(1) {
 | |
|   y = foo(y);
 | |
|   return x * 100 + y * 10 + z;
 | |
| }
 | |
| 
 | |
| int test_inline(int x, int y, int z) method_id(2) {
 | |
|   y = foo_inline(y);
 | |
|   return x * 100 + y * 10 + z;
 | |
| }
 | |
| 
 | |
| int test_inlineref(int x, int y, int z) method_id(3) {
 | |
|   y = foo_inlineref(y);
 | |
|   return x * 100 + y * 10 + z;
 | |
| }
 | |
| 
 | |
| int foo_inline_big(
 | |
|         int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10,
 | |
|         int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20
 | |
| ) inline method_id(14) {
 | |
|   try {
 | |
|     if (x1 == 7) {
 | |
|       throw(44);
 | |
|     }
 | |
|     return x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20;
 | |
|   } catch (_, _) {
 | |
|     return 1;
 | |
|   }
 | |
| }
 | |
| 
 | |
| int test_inline_big(int x, int y, int z) method_id(4) {
 | |
|   y = foo_inline_big(
 | |
|           y, y + 1, y + 2, y + 3, y + 4, y + 5, y + 6, y + 7, y + 8, y + 9,
 | |
|           y + 10, y + 11, y + 12, y + 13, y + 14, y + 15, y + 16, y + 17, y + 18, y + 19);
 | |
|   return x * 1000000 + y * 1000 + z;
 | |
| }
 | |
| 
 | |
| int foo_big(
 | |
|         int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10,
 | |
|         int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20
 | |
| ) method_id(15) {
 | |
|   try {
 | |
|     if (x1 == 7) {
 | |
|       throw(44);
 | |
|     }
 | |
|     return x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20;
 | |
|   } catch (_, _) {
 | |
|     return 1;
 | |
|   }
 | |
| }
 | |
| 
 | |
| int test_big(int x, int y, int z) method_id(5) {
 | |
|   y = foo_big(
 | |
|           y, y + 1, y + 2, y + 3, y + 4, y + 5, y + 6, y + 7, y + 8, y + 9,
 | |
|           y + 10, y + 11, y + 12, y + 13, y + 14, y + 15, y + 16, y + 17, y + 18, y + 19);
 | |
|   return x * 1000000 + y * 1000 + z;
 | |
| }
 | |
| 
 | |
| () main() {
 | |
| }
 | |
| 
 | |
| {-
 | |
|     method_id | in    | out
 | |
| TESTCASE | 1  | 1 2 3 | 123
 | |
| TESTCASE | 1  | 3 8 9 | 389
 | |
| TESTCASE | 1  | 3 7 9 | 329
 | |
| TESTCASE | 2  | 1 2 3 | 123
 | |
| TESTCASE | 2  | 3 8 9 | 389
 | |
| TESTCASE | 2  | 3 7 9 | 329
 | |
| TESTCASE | 3  | 1 2 3 | 123
 | |
| TESTCASE | 3  | 3 8 9 | 389
 | |
| TESTCASE | 3  | 3 7 9 | 329
 | |
| TESTCASE | 4  | 4 8 9 | 4350009
 | |
| TESTCASE | 4  | 4 7 9 | 4001009
 | |
| TESTCASE | 5  | 4 8 9 | 4350009
 | |
| TESTCASE | 5  | 4 7 9 | 4001009
 | |
| -}
 |