Mesa (main): microsoft/compiler: Fix assert.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 21 07:17:53 UTC 2022


Module: Mesa
Branch: main
Commit: 081b1eeacd64e02a2470af532e283578075efbed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=081b1eeacd64e02a2470af532e283578075efbed

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Thu Jun 16 15:30:23 2022 -0700

microsoft/compiler: Fix assert.

Fix defect reported by Coverity Scan.

Side effect in assertion (ASSERT_SIDE_EFFECT)
assignment_where_comparison_intended: Assignment var->type =
glsl_int_type() has a side effect. This code will work differently in a
non-debug build.

Fixes: afb64e10c1f ("microsoft/compiler: Move d3d12_fix_io_uint_type() to dxil_nir.c")
Suggested-by: Boris Brezillon <boris.brezillon at collabora.com>
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17097>

---

 src/microsoft/compiler/dxil_nir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/microsoft/compiler/dxil_nir.c b/src/microsoft/compiler/dxil_nir.c
index c309338d45d..a2d2994fc2d 100644
--- a/src/microsoft/compiler/dxil_nir.c
+++ b/src/microsoft/compiler/dxil_nir.c
@@ -1993,7 +1993,10 @@ fix_io_uint_type(nir_shader *s, nir_variable_mode modes, int slot)
    nir_variable *fixed_var = NULL;
    nir_foreach_variable_with_modes(var, s, modes) {
       if (var->data.location == slot) {
-         assert(var->type = glsl_int_type());
+         if (var->type == glsl_uint_type())
+            return false;
+
+         assert(var->type == glsl_int_type());
          var->type = glsl_uint_type();
          fixed_var = var;
          break;



More information about the mesa-commit mailing list