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

Author: Juan A. Suarez Romero <[email protected]>
Date:   Fri Apr  9 10:59:14 2021 +0200

broadcom/compiler: use signed pointers for packed condition

`qpu.raddr_b` is an unsigned int, so it is always positive, even after
casting to signed int.

Fixes CID#1438117 "Operands don't affect result
(CONSTANT_EXPRESSION_RESULT)":

   "result_independent_of_operands: (int)inst->qpu.raddr_b >= -16 is
    always true regardless of the values of its operands. This occurs as
    the logical first operand of "&&".

v2:
 - Use signed pointers (Iago)

Reviewed-by: Iago Toral Quiroga <[email protected]>
Signed-off-by: Juan A. Suarez Romero <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10131>

---

 src/broadcom/compiler/vir_dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/broadcom/compiler/vir_dump.c b/src/broadcom/compiler/vir_dump.c
index db8ff87f90d..5c47bbdc1b0 100644
--- a/src/broadcom/compiler/vir_dump.c
+++ b/src/broadcom/compiler/vir_dump.c
@@ -174,8 +174,8 @@ vir_print_reg(struct v3d_compile *c, const struct qinst 
*inst,
                                                    &unpacked);
                 assert(ok); (void) ok;
 
-                if ((int)inst->qpu.raddr_b >= -16 &&
-                    (int)inst->qpu.raddr_b <= 15)
+                int8_t *p = (int8_t *)&inst->qpu.raddr_b;
+                if (*p >= -16 && *p <= 15)
                         fprintf(stderr, "%d", unpacked);
                 else
                         fprintf(stderr, "%f", uif(unpacked));

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

Reply via email to