[Mesa-dev] [PATCH] i965/fs: Fix a couple of uninitialized value warnings

Matt Turner mattst88 at gmail.com
Tue Sep 30 16:24:40 PDT 2014


On Tue, Sep 30, 2014 at 3:42 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 6ed3e95..7e4cb04 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -2579,7 +2579,7 @@ fs_visitor::emit_repclear_shader()
>                             fs_reg(UNIFORM, 0, BRW_REGISTER_TYPE_F)));
>     mov->force_writemask_all = true;
>
> -   fs_inst *write;
> +   fs_inst *write = NULL;
>     if (key->nr_color_regions == 1) {
>        write = emit(FS_OPCODE_REP_FB_WRITE);
>        write->saturate = key->clamp_fragment_color;
> @@ -2588,6 +2588,7 @@ fs_visitor::emit_repclear_shader()
>        write->header_present = false;
>        write->mlen = 1;
>     } else {
> +      assert(key->nr_color_regions > 0);

I'd rather add an assume macro to util/macros.h and use it here. I've
sent a pair of patches to do this.

>        for (int i = 0; i < key->nr_color_regions; ++i) {
>           write = emit(FS_OPCODE_REP_FB_WRITE);
>           write->saturate = key->clamp_fragment_color;
> @@ -2963,11 +2964,12 @@ fs_visitor::lower_load_payload()
>     memset(metadata, 0, sizeof(metadata));
>
>     foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
> -      int dst_reg;
> -      if (inst->dst.file == MRF) {
> -         dst_reg = inst->dst.reg;
> -      } else if (inst->dst.file == GRF) {
> +      int dst_reg ;

Space added before ;

With that fixed, the second hunk is

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list