broadcom/compiler: don't use VLA on emit alu

Using constant-size array instead of variable-length array is preferred
due several issues with the latter.

Particularly, for this case using VLA generates several warnings by
static analyzer: passed-by-value struct argument contains uninitialized
data (e.g., field: 'file').

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-03-13 12:15:34 +01:00 committed by Marge Bot
parent 01151f045f
commit 0e50b09d4a

View file

@ -1375,7 +1375,8 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr)
}
/* General case: We can just grab the one used channel per src. */
struct qreg src[nir_op_infos[instr->op].num_inputs];
assert(nir_op_infos[instr->op].num_inputs <= 3);
struct qreg src[3] = { 0 };
for (int i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
src[i] = ntq_get_alu_src(c, instr, i);
}