intel/compiler: Silence maybe-uninitialized warning in GCC 9.1.1
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 23 Aug 2019 14:41:18 +0000 (07:41 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 23 Aug 2019 20:25:27 +0000 (13:25 -0700)
commitf7d90c67c7d564c270afc8ddf66ea1279043e39f
tree19f28144c8b64c7d99bcf01c33abcd8fa0acc314
parenta410823b3ede9ff3bf7f56ffca295d1b3d04dbad
intel/compiler: Silence maybe-uninitialized warning in GCC 9.1.1

Compiler can't see that d is initialized.

    ../src/intel/compiler/brw_vec4_nir.cpp: In function ‘int brw::try_immediate_source(const nir_alu_instr*, brw::src_reg*, bool, const gen_device_info*)’:
    ../src/intel/compiler/brw_vec4_nir.cpp:984:12: warning: ‘d’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      984 |          d = MAX2(-d, d);

Assert that we expect at least one component -- hence d going to be
set.  That by itself is not enough, so also zero initialize the
variable.

Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_vec4_nir.cpp