diff --git a/pythonbpf/functions_pass.py b/pythonbpf/functions_pass.py index e343aa3..a8f106a 100644 --- a/pythonbpf/functions_pass.py +++ b/pythonbpf/functions_pass.py @@ -385,7 +385,7 @@ def process_stmt( ) elif isinstance(stmt, ast.Return): if stmt.value is None: - builder.ret(ir.Constant(ir.IntType(32), 0)) + builder.ret(ir.Constant(ir.IntType(64), 0)) did_return = True elif ( isinstance(stmt.value, ast.Call) @@ -582,7 +582,7 @@ def process_func_body( ) if not did_return: - builder.ret(ir.Constant(ir.IntType(32), 0)) + builder.ret(ir.Constant(ir.IntType(64), 0)) def process_bpf_chunk(func_node, module, return_type, map_sym_tab, structs_sym_tab): diff --git a/tests/failing_tests/var_rval.py b/tests/passing_tests/var_rval.py similarity index 55% rename from tests/failing_tests/var_rval.py rename to tests/passing_tests/var_rval.py index 38d993e..3fd2c10 100644 --- a/tests/failing_tests/var_rval.py +++ b/tests/passing_tests/var_rval.py @@ -1,4 +1,6 @@ -from pythonbpf import compile, bpf, section, bpfglobal +import logging + +from pythonbpf import compile, bpf, section, bpfglobal, compile_to_ir from ctypes import c_void_p, c_int64 @@ -14,5 +16,5 @@ def sometag(ctx: c_void_p) -> c_int64: def LICENSE() -> str: return "GPL" - -compile() +compile_to_ir("var_rval.py", "var_rval.ll") +compile(loglevel=logging.INFO)