On Mon, Jul 16, 2018 at 3:38 PM Caio Marcelo de Oliveira Filho
<caio.olive...@intel.com> wrote:
>
> Fixes warning:
>
> ../../src/compiler/spirv/vtn_variables.c: In function ‘var_decoration_cb’:
> ../../src/compiler/spirv/vtn_variables.c:1400:12: warning: ‘is_vertex_input’ 
> may be used uninitialized in this function [-Wmaybe-uninitialized]
>        bool is_vertex_input;
>             ^~~~~~~~~~~~~~~
>
> The code used to set is_vertex_input in all possible codepaths, but
> after 23edc5b1ef3 "spirv: translate default-block uniforms" the
> compiler isn't sure all codepaths will initialize the variable.
> ---
>  src/compiler/spirv/vtn_variables.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/compiler/spirv/vtn_variables.c 
> b/src/compiler/spirv/vtn_variables.c
> index 6bd7aa1b0d5..fbfea6f8cef 100644
> --- a/src/compiler/spirv/vtn_variables.c
> +++ b/src/compiler/spirv/vtn_variables.c
> @@ -1397,10 +1397,9 @@ var_decoration_cb(struct vtn_builder *b, struct 
> vtn_value *val, int member,
>      */
>     if (dec->decoration == SpvDecorationLocation) {
>        unsigned location = dec->literals[0];
> -      bool is_vertex_input;
> +      bool is_vertex_input = false;
>        if (b->shader->info.stage == MESA_SHADER_FRAGMENT &&
>            vtn_var->mode == vtn_variable_mode_output) {
> -         is_vertex_input = false;
>           location += FRAG_RESULT_DATA0;
>        } else if (b->shader->info.stage == MESA_SHADER_VERTEX &&
>                   vtn_var->mode == vtn_variable_mode_input) {
> @@ -1408,7 +1407,6 @@ var_decoration_cb(struct vtn_builder *b, struct 
> vtn_value *val, int member,
>           location += VERT_ATTRIB_GENERIC0;
>        } else if (vtn_var->mode == vtn_variable_mode_input ||
>                   vtn_var->mode == vtn_variable_mode_output) {
> -         is_vertex_input = false;
>           location += vtn_var->patch ? VARYING_SLOT_PATCH0 : 
> VARYING_SLOT_VAR0;
>        } else if (vtn_var->mode != vtn_variable_mode_uniform) {
>           vtn_warn("Location must be on input, output, uniform, sampler or "
> --
> 2.18.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

For the series:
Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to