Mesa (master): gallivm: Silence a warning at -Og

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 18 21:15:30 UTC 2021


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

Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jan 26 14:20:30 2021 -0500

gallivm: Silence a warning at -Og

   ../src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c: In function ‘lp_build_sample_image_linear’:
   ../src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c:1412:24: warning: ‘have_corners’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1412 |          have_corner = LLVMBuildLoad(builder, have_corners, "");

I don't think you can get here and really not have it initialized, but
if you _could_ then it would clearly be wrong to do anything, so do
nothing instead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 6740907ebcb..56e78c5bd4f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1030,7 +1030,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
    LLVMValueRef flt_width_vec;
    LLVMValueRef flt_height_vec;
    LLVMValueRef flt_depth_vec;
-   LLVMValueRef fall_off[4], have_corners;
+   LLVMValueRef fall_off[4] = { 0 }, have_corners = NULL;
    LLVMValueRef z1 = NULL;
    LLVMValueRef z00 = NULL, z01 = NULL, z10 = NULL, z11 = NULL;
    LLVMValueRef x00 = NULL, x01 = NULL, x10 = NULL, x11 = NULL;
@@ -1400,7 +1400,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
        * another branch (with corner condition though edge would work
        * as well) here.
        */
-      if (accurate_cube_corners) {
+      if (have_corners && accurate_cube_corners) {
          LLVMValueRef c00, c01, c10, c11, c00f, c01f, c10f, c11f;
          LLVMValueRef have_corner, one_third;
 
@@ -1655,7 +1655,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
          }
       }
 
-      if (accurate_cube_corners) {
+      if (have_corners && accurate_cube_corners) {
          LLVMBuildStore(builder, colors0[0], colorss[0]);
          LLVMBuildStore(builder, colors0[1], colorss[1]);
          LLVMBuildStore(builder, colors0[2], colorss[2]);



More information about the mesa-commit mailing list