]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Initialize internal temp-variables used as reference parameter
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 1 Nov 2018 23:03:45 +0000 (00:03 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 5 Nov 2018 07:47:54 +0000 (08:47 +0100)
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

index adafcaa4e71771a9e9a8a8cbd2dcc3153e6099f7..973634d02a5555328091cdee42d00f2009599dc3 100644 (file)
@@ -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;