Mesa (staging/20.0): intel/vec4: fix valgrind errors with vf_values array

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 7 17:36:21 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 1f8db816321d6b83db7e2cc038be03a092640c34
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f8db816321d6b83db7e2cc038be03a092640c34

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Tue Feb  4 14:58:17 2020 +0200

intel/vec4: fix valgrind errors with vf_values array

Fixes valgrind errors introduced since commit a8ec4082.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2346
Fixes: a8ec4082 ("nir+vtn: vec8+vec16 support")
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3691>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3691>
(cherry picked from commit da76dfb5159c2ca8ee24d64a5f85a68f28b70c65)

---

 .pick_status.json                   | 2 +-
 src/intel/compiler/brw_vec4_nir.cpp | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0030f87c3c6..33b84364ac2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -58,7 +58,7 @@
         "description": "intel/vec4: fix valgrind errors with vf_values array",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "a8ec4082a41830cf67a4fd405402fd2d820722fd"
     },
diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp
index d32f65a9dbe..31219b4b584 100644
--- a/src/intel/compiler/brw_vec4_nir.cpp
+++ b/src/intel/compiler/brw_vec4_nir.cpp
@@ -1030,7 +1030,8 @@ try_immediate_source(const nir_alu_instr *instr, src_reg *op,
       } else {
          uint8_t vf_values[4] = { 0, 0, 0, 0 };
 
-         for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) {
+         for (unsigned i = 0; i < ARRAY_SIZE(vf_values); i++) {
+
             if (op[idx].abs)
                f[i] = fabs(f[i]);
 



More information about the mesa-commit mailing list