@@ -61,7 +61,7 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
6161 if val is None :
6262 print ("Failed to evaluate struct field assignment" )
6363 return
64- builder .store (val , field_ptr )
64+ builder .store (val [ 0 ] , field_ptr )
6565 print (f"Assigned to struct field { var_name } .{ field_name } " )
6666 return
6767 elif isinstance (rval , ast .Constant ):
@@ -114,7 +114,7 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
114114 # var.align = 8
115115 val = handle_helper_call (
116116 rval , module , builder , func , local_sym_tab , map_sym_tab , structs_sym_tab , local_var_metadata )
117- builder .store (val , local_sym_tab [var_name ][0 ])
117+ builder .store (val [ 0 ] , local_sym_tab [var_name ][0 ])
118118 # local_sym_tab[var_name] = var
119119 print (f"Assigned constant { rval .func .id } to { var_name } " )
120120 elif call_type == "deref" and len (rval .args ) == 1 :
@@ -125,7 +125,7 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
125125 print ("Failed to evaluate deref argument" )
126126 return
127127 print (f"Dereferenced value: { val } , storing in { var_name } " )
128- builder .store (val , local_sym_tab [var_name ][0 ])
128+ builder .store (val [ 0 ] , local_sym_tab [var_name ][0 ])
129129 # local_sym_tab[var_name] = var
130130 print (f"Dereferenced and assigned to { var_name } " )
131131 elif call_type in structs_sym_tab and len (rval .args ) == 0 :
@@ -155,7 +155,7 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
155155 rval , module , builder , func , local_sym_tab , map_sym_tab , structs_sym_tab , local_var_metadata )
156156 # var = builder.alloca(ir.IntType(64), name=var_name)
157157 # var.align = 8
158- builder .store (val , local_sym_tab [var_name ][0 ])
158+ builder .store (val [ 0 ] , local_sym_tab [var_name ][0 ])
159159 # local_sym_tab[var_name] = var
160160 else :
161161 print ("Unsupported assignment call structure" )
@@ -462,7 +462,6 @@ def process_bpf_chunk(func_node, module, return_type, map_sym_tab, structs_sym_t
462462
463463 process_func_body (module , builder , func_node , func ,
464464 ret_type , map_sym_tab , structs_sym_tab )
465-
466465 return func
467466
468467
0 commit comments