From 0e50b09d4aba49020c671767d535b5f93e3c8670 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Thu, 13 Mar 2025 12:15:34 +0100 Subject: [PATCH] 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 Reviewed-by: Jose Maria Casanova Crespo Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/compiler/nir_to_vir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 8ed2bdf747e..741a5f8aae5 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -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); }