From 2905990683441bae3ef932ac6a24e61350105257 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 13 May 2023 08:16:51 +0530 Subject: [PATCH 1/7] ASR: Error on assigning to func param --- src/lpython/semantics/python_ast_to_asr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index b70f8df28e..b0a0424757 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -4844,6 +4844,13 @@ class BodyVisitor : public CommonVisitor { std::string var_name = std::string(v->m_name); throw SemanticError("Assignment to loop variable `" + std::string(to_lower(var_name)) +"` is not allowed", target->base.loc); } + if (sym->type == ASR::symbolType::Variable) { + ASR::Variable_t *v = ASR::down_cast(sym); + if (v->m_intent == ASR::intentType::In) { + throw SemanticError("Assignment to an input function parameter `" + + std::string(v->m_name) + "` is not allowed", target->base.loc); + } + } } tmp_vec.push_back(ASR::make_Assignment_t(al, x.base.base.loc, target, tmp_value, overloaded)); From c282a24169b59f4cdd0cf38eec7d091e2c30a1a0 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 13 May 2023 08:25:41 +0530 Subject: [PATCH 2/7] RT_LIB: Replace param assign with local var assign --- src/runtime/lpython_builtin.py | 42 +++++++++++++++++++--------------- src/runtime/math.py | 40 +++++++++++++++++++------------- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index b1fe4f40b9..1d1859ea3e 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -198,18 +198,20 @@ def bin(n: i32) -> str: return '0b0' prep: str prep = '0b' - if n < 0: - n = -n + n_: i32 + n_ = n + if n_ < 0: + n_ = -n_ prep = '-0b' res: str res = '' - if (n - _lpython_floordiv(n, 2)*2) == 0: + if (n_ - _lpython_floordiv(n_, 2)*2) == 0: res += '0' else: res += '1' - while n > 1: - n = _lpython_floordiv(n, 2) - if (n - _lpython_floordiv(n, 2)*2) == 0: + while n_ > 1: + n_ = _lpython_floordiv(n_, 2) + if (n_ - _lpython_floordiv(n_, 2)*2) == 0: res += '0' else: res += '1' @@ -227,16 +229,18 @@ def hex(n: i32) -> str: return '0x0' prep: str prep = '0x' - if n < 0: + n_: i32 + n_ = n + if n_ < 0: prep = '-0x' - n = -n + n_ = -n_ res: str res = "" remainder: i32 - while n > 0: - remainder = n - _lpython_floordiv(n, 16)*16 - n -= remainder - n = _lpython_floordiv(n, 16) + while n_ > 0: + remainder = n_ - _lpython_floordiv(n_, 16)*16 + n_ -= remainder + n_ = _lpython_floordiv(n_, 16) res += hex_values[remainder] return prep + res[::-1] @@ -252,16 +256,18 @@ def oct(n: i32) -> str: return '0o0' prep: str prep = '0o' - if n < 0: + n_: i32 + n_ = n + if n_ < 0: prep = '-0o' - n = -n + n_ = -n_ res: str res = "" remainder: i32 - while n > 0: - remainder = n - _lpython_floordiv(n, 8)*8 - n -= remainder - n = _lpython_floordiv(n, 8) + while n_ > 0: + remainder = n_ - _lpython_floordiv(n_, 8)*8 + n_ -= remainder + n_ = _lpython_floordiv(n_, 8) res += _values[remainder] return prep + res[::-1] diff --git a/src/runtime/math.py b/src/runtime/math.py index 86af575ed1..5f93ad8492 100644 --- a/src/runtime/math.py +++ b/src/runtime/math.py @@ -472,29 +472,37 @@ def gcd(a: i32, b: i32) -> i32: Returns greatest common divisor of `a` and `b` """ temp: i32 - if a < 0: - a = -a - if b < 0: - b = -b - while b != 0: - a = mod(a, b) - temp = a - a = b - b = temp - return a + a_: i32 + b_: i32 + a_ = a + b_ = b + if a_ < 0: + a_ = -a_ + if b_ < 0: + b_ = -b_ + while b_ != 0: + a_ = mod(a_, b_) + temp = a_ + a_ = b_ + b_ = temp + return a_ def lcm(a: i32, b: i32) -> i32: """ Returns least common multiple of `a` and `b` """ - if a < 0: - a = -a - if b < 0: - b = -b - if a*b == 0: + a_: i32 + b_: i32 + a_ = a + b_ = b + if a_ < 0: + a_ = -a_ + if b_ < 0: + b_ = -b_ + if a_*b_ == 0: return 0 - return i32(floor((a*b)/gcd(a, b))) + return i32(floor((a_*b_)/gcd(a_, b_))) def copysign(x: f64, y: f64) -> f64: From 415d36e8f6bbd16a93504b047afccbe73a76a847 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 13 May 2023 18:46:07 +0530 Subject: [PATCH 3/7] Commit white space removals --- src/runtime/lpython_builtin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index 1d1859ea3e..aedabf5251 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -811,18 +811,18 @@ def _lpython_str_startswith(s: str ,sub: str) -> bool: return res @overload -def _lpython_str_endswith(s: str, suffix: str) -> bool: +def _lpython_str_endswith(s: str, suffix: str) -> bool: if(len(suffix) > len(s)): return False - + i : i32 i = 0 while(i < len(suffix)): if(suffix[len(suffix) - i - 1] != s[len(s) - i - 1]): return False i += 1 - + return True @overload @@ -839,13 +839,13 @@ def _lpython_str_partition(s:str, sep: str) -> tuple[str, str, str]: ind = _lpython_str_find(s, sep) if ind == -1: res = (s, "", "") - else: - res = (s[0:ind], sep, s[ind+len(sep): len(s)]) + else: + res = (s[0:ind], sep, s[ind+len(sep): len(s)]) return res @overload def _lpython_str_islower(s: str) -> bool: - is_cased_present: bool + is_cased_present: bool is_cased_present = False i:str for i in s: @@ -857,7 +857,7 @@ def _lpython_str_islower(s: str) -> bool: @overload def _lpython_str_isupper(s: str) -> bool: - is_cased_present: bool + is_cased_present: bool is_cased_present = False i:str for i in s: From 8c73df8956a353aece016c143684c24767cd37bc Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 13 May 2023 19:27:13 +0530 Subject: [PATCH 4/7] TEST: Remove assign to func param --- tests/expr9.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/expr9.py b/tests/expr9.py index faba7dd662..f888ca90d7 100644 --- a/tests/expr9.py +++ b/tests/expr9.py @@ -11,20 +11,14 @@ def test_return_2(a: i32) -> str: def test_return_3(a: i32) -> i32: - a = 3 return a -def test_return_4(a: i32): - a = 1 - return - def main0(): i: i32 i = test_return_1(4) s: str s = test_return_2(4) i = test_return_3(4) - test_return_4(4) main0() From bf95670921db01170d9b527307b4c413b574476c Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 13 May 2023 08:26:01 +0530 Subject: [PATCH 5/7] TEST: Add test for func param assign --- tests/errors/test_assign9.py | 5 +++++ tests/tests.toml | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 tests/errors/test_assign9.py diff --git a/tests/errors/test_assign9.py b/tests/errors/test_assign9.py new file mode 100644 index 0000000000..e5f8d90e73 --- /dev/null +++ b/tests/errors/test_assign9.py @@ -0,0 +1,5 @@ +def f(x: i32) -> i32: + x = 2 + return x * x + +print(f(3)) # => 4 diff --git a/tests/tests.toml b/tests/tests.toml index 9e3e82f142..5eb4f90f01 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -820,6 +820,10 @@ asr = true filename = "errors/test_assign8.py" asr = true +[[test]] +filename = "errors/test_assign9.py" +asr = true + [[test]] filename = "errors/test_binop1.py" asr = true From 544e5279729863866507597c2f9540d02c48b661 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Thu, 18 May 2023 09:46:48 +0530 Subject: [PATCH 6/7] TEST: Use InOut in generics_02 test case --- integration_tests/generics_02.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration_tests/generics_02.py b/integration_tests/generics_02.py index c9be2672b4..4242741364 100644 --- a/integration_tests/generics_02.py +++ b/integration_tests/generics_02.py @@ -1,8 +1,8 @@ -from lpython import TypeVar +from lpython import TypeVar, InOut T = TypeVar('T') -def swap(x: T, y: T): +def swap(x: InOut[T], y: InOut[T]): temp: T temp = x x = y @@ -10,4 +10,4 @@ def swap(x: T, y: T): print(x) print(y) -swap(1,2) \ No newline at end of file +swap(1,2) From 41cb230adcdb24e0c478617ff7979fb16654626a Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Thu, 18 May 2023 09:48:07 +0530 Subject: [PATCH 7/7] TEST: Update reference tests --- tests/reference/asr-expr9-814e4bc.json | 4 +- tests/reference/asr-expr9-814e4bc.stdout | 97 ++++--------------- tests/reference/asr-generics_02-e2ea5c9.json | 4 +- .../reference/asr-generics_02-e2ea5c9.stdout | 8 +- tests/reference/asr-test_assign9-51278b8.json | 13 +++ .../reference/asr-test_assign9-51278b8.stderr | 5 + tests/reference/ast-expr9-d184496.json | 4 +- tests/reference/ast-expr9-d184496.stdout | 58 +---------- tests/reference/cpp-expr9-48868e9.json | 4 +- tests/reference/cpp-expr9-48868e9.stdout | 9 -- tests/reference/wat-expr9-f73afd1.json | 4 +- tests/reference/wat-expr9-f73afd1.stdout | 18 +--- 12 files changed, 53 insertions(+), 175 deletions(-) create mode 100644 tests/reference/asr-test_assign9-51278b8.json create mode 100644 tests/reference/asr-test_assign9-51278b8.stderr diff --git a/tests/reference/asr-expr9-814e4bc.json b/tests/reference/asr-expr9-814e4bc.json index 69e37a05c0..23813fb401 100644 --- a/tests/reference/asr-expr9-814e4bc.json +++ b/tests/reference/asr-expr9-814e4bc.json @@ -2,11 +2,11 @@ "basename": "asr-expr9-814e4bc", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/expr9.py", - "infile_hash": "1f02a7486b298ae9e74a163875a76f8fa7cc25d7f50547133dbbdfab", + "infile_hash": "4819e0f20d2ed25647ab94f74cb7b5b61e3d4f43e159e46ad79c1c4c", "outfile": null, "outfile_hash": null, "stdout": "asr-expr9-814e4bc.stdout", - "stdout_hash": "fd9a9323419a77d41f2b3b06c607be0aab4dc626a070dda593b2117c", + "stdout_hash": "b1daccda9413a8fc6ad88b8898e011d5f556e862f9b853b3564d7189", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr9-814e4bc.stdout b/tests/reference/asr-expr9-814e4bc.stdout index 2418acea28..58cd971194 100644 --- a/tests/reference/asr-expr9-814e4bc.stdout +++ b/tests/reference/asr-expr9-814e4bc.stdout @@ -5,12 +5,12 @@ _global_symbols: (Module (SymbolTable - 9 + 8 { _lpython_main_program: (Function (SymbolTable - 8 + 7 { }) @@ -33,7 +33,7 @@ [main0] [] [(SubroutineCall - 9 main0 + 8 main0 () [] () @@ -47,11 +47,11 @@ main0: (Function (SymbolTable - 6 + 5 { i: (Variable - 6 + 5 i [] Local @@ -66,7 +66,7 @@ ), s: (Variable - 6 + 5 s [] Local @@ -98,13 +98,12 @@ ) [test_return_1 test_return_2 - test_return_3 - test_return_4] + test_return_3] [] [(= - (Var 6 i) + (Var 5 i) (FunctionCall - 9 test_return_1 + 8 test_return_1 () [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) @@ -114,9 +113,9 @@ () ) (= - (Var 6 s) + (Var 5 s) (FunctionCall - 9 test_return_2 + 8 test_return_2 () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) @@ -126,9 +125,9 @@ () ) (= - (Var 6 i) + (Var 5 i) (FunctionCall - 9 test_return_3 + 8 test_return_3 () [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) @@ -136,12 +135,6 @@ () ) () - ) - (SubroutineCall - 9 test_return_4 - () - [((IntegerConstant 4 (Integer 4 [])))] - () )] () Public @@ -379,11 +372,6 @@ [] [(Var 4 a)] [(= - (Var 4 a) - (IntegerConstant 3 (Integer 4 [])) - () - ) - (= (Var 4 _lpython_return_variable) (Var 4 a) () @@ -394,57 +382,6 @@ .false. .false. () - ), - test_return_4: - (Function - (SymbolTable - 5 - { - a: - (Variable - 5 - a - [] - In - () - () - Default - (Integer 4 []) - Source - Public - Required - .false. - ) - }) - test_return_4 - (FunctionType - [(Integer 4 [])] - () - Source - Implementation - () - .false. - .false. - .false. - .false. - .false. - [] - [] - .false. - ) - [] - [(Var 5 a)] - [(= - (Var 5 a) - (IntegerConstant 1 (Integer 4 [])) - () - ) - (Return)] - () - Public - .false. - .false. - () ) }) _global_symbols @@ -455,13 +392,13 @@ main_program: (Program (SymbolTable - 7 + 6 { _lpython_main_program: (ExternalSymbol - 7 + 6 _lpython_main_program - 9 _lpython_main_program + 8 _lpython_main_program _global_symbols [] _lpython_main_program @@ -471,7 +408,7 @@ main_program [_global_symbols] [(SubroutineCall - 7 _lpython_main_program + 6 _lpython_main_program () [] () diff --git a/tests/reference/asr-generics_02-e2ea5c9.json b/tests/reference/asr-generics_02-e2ea5c9.json index 4d1c303db4..9057044111 100644 --- a/tests/reference/asr-generics_02-e2ea5c9.json +++ b/tests/reference/asr-generics_02-e2ea5c9.json @@ -2,11 +2,11 @@ "basename": "asr-generics_02-e2ea5c9", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/generics_02.py", - "infile_hash": "1103ff0edcb14e988eaa30252064dd77c7012884226c63f35f7aab01", + "infile_hash": "f34adf5280ade332f6f72c81cdc0d18b463176f23df500f7a08370e0", "outfile": null, "outfile_hash": null, "stdout": "asr-generics_02-e2ea5c9.stdout", - "stdout_hash": "e1448166e4027e61053bec1c27e7887537ea0be09fbee1149526ad70", + "stdout_hash": "07c6fa8bd4b7c07692d940f3a74dae682991c938db791445065c3638", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-generics_02-e2ea5c9.stdout b/tests/reference/asr-generics_02-e2ea5c9.stdout index c00b5c404e..57e8b3ef59 100644 --- a/tests/reference/asr-generics_02-e2ea5c9.stdout +++ b/tests/reference/asr-generics_02-e2ea5c9.stdout @@ -50,7 +50,7 @@ 3 x [] - In + InOut () () Default @@ -65,7 +65,7 @@ 3 y [] - In + InOut () () Default @@ -195,7 +195,7 @@ 2 x [] - In + InOut () () Default @@ -213,7 +213,7 @@ 2 y [] - In + InOut () () Default diff --git a/tests/reference/asr-test_assign9-51278b8.json b/tests/reference/asr-test_assign9-51278b8.json new file mode 100644 index 0000000000..bc722c74c9 --- /dev/null +++ b/tests/reference/asr-test_assign9-51278b8.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-test_assign9-51278b8", + "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/errors/test_assign9.py", + "infile_hash": "3aa4fda6489ce46f10fd95cd257f5d29a59629fc340d6d8ea5e983d8", + "outfile": null, + "outfile_hash": null, + "stdout": null, + "stdout_hash": null, + "stderr": "asr-test_assign9-51278b8.stderr", + "stderr_hash": "8b4d51f9bf59bac908de3baae8af9aa0cc9f99c7b16face93e04abdc", + "returncode": 2 +} \ No newline at end of file diff --git a/tests/reference/asr-test_assign9-51278b8.stderr b/tests/reference/asr-test_assign9-51278b8.stderr new file mode 100644 index 0000000000..8c59143839 --- /dev/null +++ b/tests/reference/asr-test_assign9-51278b8.stderr @@ -0,0 +1,5 @@ +semantic error: Assignment to an input function parameter `x` is not allowed + --> tests/errors/test_assign9.py:2:5 + | +2 | x = 2 + | ^ diff --git a/tests/reference/ast-expr9-d184496.json b/tests/reference/ast-expr9-d184496.json index e177e00997..bc5e3f36d2 100644 --- a/tests/reference/ast-expr9-d184496.json +++ b/tests/reference/ast-expr9-d184496.json @@ -2,11 +2,11 @@ "basename": "ast-expr9-d184496", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/expr9.py", - "infile_hash": "1f02a7486b298ae9e74a163875a76f8fa7cc25d7f50547133dbbdfab", + "infile_hash": "4819e0f20d2ed25647ab94f74cb7b5b61e3d4f43e159e46ad79c1c4c", "outfile": null, "outfile_hash": null, "stdout": "ast-expr9-d184496.stdout", - "stdout_hash": "53f5e472ca197da7600955039541adb81d458cf53ea6e9c27b742adb", + "stdout_hash": "75772c0465dba8aaa9f5cebf3c35558b77827a9b29570828744d84d9", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-expr9-d184496.stdout b/tests/reference/ast-expr9-d184496.stdout index 55c297f061..bae64591f4 100644 --- a/tests/reference/ast-expr9-d184496.stdout +++ b/tests/reference/ast-expr9-d184496.stdout @@ -113,18 +113,7 @@ [] [] []) - [(Assign - [(Name - a - Store - )] - (ConstantInt - 3 - () - ) - () - ) - (Return + [(Return (Name a Load @@ -137,38 +126,6 @@ ) () ) - (FunctionDef - test_return_4 - ([] - [(a - (Name - i32 - Load - ) - ())] - [] - [] - [] - [] - []) - [(Assign - [(Name - a - Store - )] - (ConstantInt - 1 - () - ) - () - ) - (Return - () - )] - [] - () - () - ) (FunctionDef main0 ([] @@ -255,19 +212,6 @@ [] ) () - ) - (Expr - (Call - (Name - test_return_4 - Load - ) - [(ConstantInt - 4 - () - )] - [] - ) )] [] () diff --git a/tests/reference/cpp-expr9-48868e9.json b/tests/reference/cpp-expr9-48868e9.json index 1b3a034176..3148e0cf89 100644 --- a/tests/reference/cpp-expr9-48868e9.json +++ b/tests/reference/cpp-expr9-48868e9.json @@ -2,11 +2,11 @@ "basename": "cpp-expr9-48868e9", "cmd": "lpython --no-color --show-cpp {infile}", "infile": "tests/expr9.py", - "infile_hash": "1f02a7486b298ae9e74a163875a76f8fa7cc25d7f50547133dbbdfab", + "infile_hash": "4819e0f20d2ed25647ab94f74cb7b5b61e3d4f43e159e46ad79c1c4c", "outfile": null, "outfile_hash": null, "stdout": "cpp-expr9-48868e9.stdout", - "stdout_hash": "8b28ac34d62789df68c60f9a9e6925dbbe05f910916eca7cc0c47c42", + "stdout_hash": "1e07d4af4823dc3f759e16cf567f814918c22127127013a16da3f473", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/cpp-expr9-48868e9.stdout b/tests/reference/cpp-expr9-48868e9.stdout index da1fa826c7..6b306db744 100644 --- a/tests/reference/cpp-expr9-48868e9.stdout +++ b/tests/reference/cpp-expr9-48868e9.stdout @@ -28,7 +28,6 @@ void main0(); int32_t test_return_1(int32_t a); std::string test_return_2(int32_t a); int32_t test_return_3(int32_t a); -void test_return_4(int32_t a); namespace { } @@ -54,17 +53,10 @@ std::string test_return_2(int32_t a) int32_t test_return_3(int32_t a) { int32_t _lpython_return_variable; - a = 3; _lpython_return_variable = a; return _lpython_return_variable; } -void test_return_4(int32_t a) -{ - a = 1; - return; -} - void main0() { int32_t i; @@ -72,7 +64,6 @@ void main0() i = test_return_1(4); s = test_return_2(4); i = test_return_3(4); - test_return_4(4); } void _lpython_main_program() diff --git a/tests/reference/wat-expr9-f73afd1.json b/tests/reference/wat-expr9-f73afd1.json index 9af749c758..632e8d67ef 100644 --- a/tests/reference/wat-expr9-f73afd1.json +++ b/tests/reference/wat-expr9-f73afd1.json @@ -2,11 +2,11 @@ "basename": "wat-expr9-f73afd1", "cmd": "lpython --no-color --show-wat {infile}", "infile": "tests/expr9.py", - "infile_hash": "1f02a7486b298ae9e74a163875a76f8fa7cc25d7f50547133dbbdfab", + "infile_hash": "4819e0f20d2ed25647ab94f74cb7b5b61e3d4f43e159e46ad79c1c4c", "outfile": null, "outfile_hash": null, "stdout": "wat-expr9-f73afd1.stdout", - "stdout_hash": "1abbbc8caa76776e7ddda21597370a9712e50ff185fe6a08664cbc7f", + "stdout_hash": "5bbffc0b6257a735f45545017043d33024bee99cd55dd28997452bb6", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/wat-expr9-f73afd1.stdout b/tests/reference/wat-expr9-f73afd1.stdout index 6309482f01..5ee88dc39a 100644 --- a/tests/reference/wat-expr9-f73afd1.stdout +++ b/tests/reference/wat-expr9-f73afd1.stdout @@ -6,8 +6,7 @@ (type (;4;) (func (param i32) (result i32))) (type (;5;) (func (param i32) (result i32))) (type (;6;) (func (param i32) (result i32))) - (type (;7;) (func (param i32) (result))) - (type (;8;) (func (param) (result))) + (type (;7;) (func (param) (result))) (import "wasi_snapshot_preview1" "proc_exit" (func (;0;) (type 0))) (import "wasi_snapshot_preview1" "fd_write" (func (;1;) (type 1))) (global $0 (mut i32) (i32.const 0)) @@ -31,8 +30,6 @@ i32.const 4 call 6 local.set 0 - i32.const 4 - call 7 return ) (func $4 (type 4) (param i32) (result i32) @@ -55,20 +52,12 @@ ) (func $6 (type 6) (param i32) (result i32) (local i32) - i32.const 3 - local.set 0 local.get 0 local.set 1 local.get 1 return ) - (func $7 (type 7) (param i32) (result) - (local) - i32.const 1 - local.set 0 - return - ) - (func $8 (type 8) (param) (result) + (func $7 (type 7) (param) (result) (local) call 2 i32.const 0 @@ -82,8 +71,7 @@ (export "test_return_1" (func 4)) (export "test_return_2" (func 5)) (export "test_return_3" (func 6)) - (export "test_return_4" (func 7)) - (export "_start" (func 8)) + (export "_start" (func 7)) (data (;0;) (i32.const 4) "\0c\00\00\00\01\00\00\00") (data (;1;) (i32.const 12) " ") (data (;2;) (i32.const 16) "\18\00\00\00\01\00\00\00")