@@ -461,14 +461,14 @@ void c_typecheck_baset::typecheck_expr_builtin_va_arg(exprt &expr)
461461
462462 implicit_typecast (arg, pointer_type (void_type ()));
463463
464+ symbol_exprt function (ID_gcc_builtin_va_arg, new_type);
465+ function.add_source_location () = expr.source_location ();
466+
464467 // turn into function call
465- side_effect_expr_function_callt result;
468+ side_effect_expr_function_callt result (
469+ function, {arg}, new_type.return_type ());
470+
466471 result.add_source_location ()=expr.source_location ();
467- result.function ()=symbol_exprt (ID_gcc_builtin_va_arg);
468- result.function ().add_source_location ()=expr.source_location ();
469- result.function ().type ()=new_type;
470- result.arguments ().push_back (arg);
471- result.type ()=new_type.return_type ();
472472
473473 expr.swap (result);
474474
@@ -881,15 +881,13 @@ void c_typecheck_baset::typecheck_side_effect_statement_expression(
881881
882882 code_function_callt &fc=to_code_function_call (last);
883883
884- side_effect_expr_function_callt sideeffect;
884+ auto return_type =
885+ static_cast <const typet &>(fc.function ().type ().find (ID_return_type));
885886
886- sideeffect. function ()=fc. function ();
887- sideeffect. arguments ()= fc.arguments ();
887+ side_effect_expr_function_callt sideeffect (
888+ fc. function (), fc.arguments (), return_type );
888889 sideeffect.add_source_location ()=fc.source_location ();
889890
890- sideeffect.type ()=
891- static_cast <const typet &>(fc.function ().type ().find (ID_return_type));
892-
893891 expr.type ()=sideeffect.type ();
894892
895893 if (fc.lhs ().is_nil ())
0 commit comments