]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Initialize internal temp-variables used as reference parameter 9cb2f01798d50b355bbd1da00fa4de5ca25f4e0e
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 1 Nov 2018 23:03:45 +0000 (00:03 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 2 Nov 2018 08:38:32 +0000 (09:38 +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 aa7d91cab31fafb5415163d86b624f4b6f6e6839..151875fcff5502075c9f4ac63b6b4f9555057859 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;