v3d: avoid 0-size variable length array
Declaring a variable-length array (VLA) based on a variable that can be 0 is declared dangerous. In this case, the variable can't take value 0, so adding an assertion fixes the issue. This was detected by static analyzer. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32819>
This commit is contained in:

committed by
Marge Bot

parent
f94bd67b82
commit
0d14e129bc
@@ -267,6 +267,8 @@ get_spill_type_for_temp(struct v3d_compile *c, int temp)
|
||||
static int
|
||||
v3d_choose_spill_node(struct v3d_compile *c)
|
||||
{
|
||||
assert(c->num_temps > 1);
|
||||
|
||||
const float tmu_scale = 10;
|
||||
float block_scale = 1.0;
|
||||
float spill_costs[c->num_temps];
|
||||
|
Reference in New Issue
Block a user