Module: Mesa
Branch: master
Commit: 577c8d72882a909ae7d2c90d7c8250c77475f9a4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=577c8d72882a909ae7d2c90d7c8250c77475f9a4

Author: Caio Marcelo de Oliveira Filho <[email protected]>
Date:   Mon Jul 16 14:59:32 2018 -0700

i965/miptree: avoid uninitialized variable warnings

GCC 8.1.1 is having a hard time identifying that the values are
properly initialized when used. In the 'memset_value' case, we pass
the uninitialized value to another function (that will use only if the
conditions match the initialization).

Just give enough hint to the compiler to figure things out. Fixes the
warnings

../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c: In function 
‘intel_miptree_alloc_aux’:
../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1839:18: warning: 
‘memset_value’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
    mt->aux_buf = intel_alloc_aux_buffer(brw, &aux_surf, needs_memset,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                         memset_value);
                                         ~~~~~~~~~~~~~
../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1698:10: warning: 
‘initial_state’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
       if (wants_memset)
          ^
../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1772:23: note: 
‘initial_state’ was declared here
    enum isl_aux_state initial_state;
                       ^~~~~~~~~~~~~

Reviewed-by: Anuj Phogat <[email protected]>

---

 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 7b1f0896ae..a18d5ac362 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1772,7 +1772,7 @@ intel_miptree_alloc_aux(struct brw_context *brw,
    enum isl_aux_state initial_state;
    uint8_t memset_value;
    struct isl_surf aux_surf;
-   MAYBE_UNUSED bool aux_surf_ok;
+   MAYBE_UNUSED bool aux_surf_ok = false;
 
    switch (mt->aux_usage) {
    case ISL_AUX_USAGE_NONE:
@@ -1781,6 +1781,7 @@ intel_miptree_alloc_aux(struct brw_context *brw,
       break;
    case ISL_AUX_USAGE_HIZ:
       initial_state = ISL_AUX_STATE_AUX_INVALID;
+      memset_value = 0;
       aux_surf_ok = isl_surf_get_hiz_surf(&brw->isl_dev, &mt->surf, &aux_surf);
       break;
    case ISL_AUX_USAGE_MCS:

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to