diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index 52e1f99..a5c97c4 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -115,6 +115,14 @@ let copname = function let cvar_of_vd vd = name vd.v_ident, ctype_of_otype vd.v_type +let inputlist_of_ovarlist vl = + let cvar_of_ovar vd = + let ty = ctype_of_otype vd.v_type in + let ty = if Linearity.is_linear vd.v_linearity then pointer_to ty else ty in + name vd.v_ident, ty + in + List.map cvar_of_ovar vl + (** @return the unaliased version of a type. *) let rec unalias_ctype cty = match cty with | Cty_id ty_name -> @@ -583,7 +591,7 @@ let qn_append q suffix = (** Builds the argument list of step function*) let step_fun_args n md = - let args = List.map cvar_of_vd md.m_inputs in + let args = inputlist_of_ovarlist md.m_inputs in let out_arg = [("out", Cty_ptr (Cty_id (qn_append n "_out")))] in let context_arg = if is_stateful n then diff --git a/compiler/obc/c/cmain.ml b/compiler/obc/c/cmain.ml index 38478e0..9449f2d 100644 --- a/compiler/obc/c/cmain.ml +++ b/compiler/obc/c/cmain.ml @@ -216,7 +216,7 @@ let main_def_of_class_def cd = split (map write_lhs_of_ty_for_vd stepm.m_outputs) in let printf_calls = List.concat printf_calls in - let cinp = List.map cvar_of_vd stepm.m_inputs in + let cinp = inputlist_of_ovarlist stepm.m_inputs in let cout = ["res", (Cty_id (qn_append cd.cd_name "_out"))] in let varlist =