[vala/0.42] codegen: Initialize internal temp-variables used as reference parameter



commit d9d037dc555d75f5f3d7f3a6f9a1c7325c839988
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Nov 2 00:03:45 2018 +0100

    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 adafcaa4e..973634d02 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]