From 9cb2f01798d50b355bbd1da00fa4de5ca25f4e0e Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Fri, 2 Nov 2018 00:03:45 +0100 Subject: [PATCH] codegen: Initialize internal temp-variables used as reference parameter When casting Variant to multi-dimensional arrays the length fields are used as out-parameters and needs to be initialized. They are not guaranteed to be all set in _variant_get*() in this case. Fixes tests with -Werror=maybe-uninitialized --- codegen/valaccodebasemodule.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index aa7d91cab..151875fcf 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -5187,7 +5187,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { var ccall = new CCodeFunctionCall (new CCodeIdentifier (variant_func)); ccall.add_argument (get_cvalue_ (variant)); - var result = create_temp_value (to, false, node); + var needs_init = (to is ArrayType); + var result = create_temp_value (to, needs_init, node); var cfunc = new CCodeFunction (variant_func); cfunc.modifiers = CCodeModifiers.STATIC; -- 2.47.2