vc4: add assertion on constant_fold

This fixes an issue detected by static analyzer: the right operand of
'>>' is a garbage value due to array index out of bounds.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34050>
This commit is contained in:
Juan A. Suarez Romero 2025-01-13 14:27:50 +01:00 committed by Marge Bot
parent 54db7c46fa
commit 8f5423820a

View file

@ -80,6 +80,7 @@ constant_fold(struct vc4_compile *c, struct qinst *inst)
uint32_t result = 0;
switch (inst->op) {
case QOP_SHR:
assert(nsrc == 2);
result = ui[0] >> ui[1];
break;