mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
freedreno: a2xx: fix maybe uninitialized variable
Detected when working on adding support for Undefined Behaviour
Sanitizer, this fixes:
```
../src/gallium/drivers/freedreno/a2xx/ir2_nir.c: In function 'load_const':
../src/gallium/drivers/freedreno/a2xx/ir2_nir.c:154:24: error: 'swiz' may be used uninitialized [-Werror=maybe-uninitialized]
154 | unsigned imm_ncomp, swiz, idx, i, j;
| ^~~~
../src/gallium/drivers/freedreno/a2xx/ir2_nir.c:195:30: error: 'imm_ncomp' may be used uninitialized [-Werror=maybe-uninitialized]
195 | so->immediates[idx].ncomp = imm_ncomp;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
../src/gallium/drivers/freedreno/a2xx/ir2_nir.c:154:13: note: 'imm_ncomp' was declared here
154 | unsigned imm_ncomp, swiz, idx, i, j;
| ^~~~~~~~~
cc1: all warnings being treated as errors
```
Reviewed-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30880>
This commit is contained in:
parent
dab7b23d3a
commit
9d6c667151
1 changed files with 3 additions and 1 deletions
|
|
@ -134,7 +134,9 @@ static struct ir2_src
|
|||
load_const(struct ir2_context *ctx, float *value_f, unsigned ncomp)
|
||||
{
|
||||
struct fd2_shader_stateobj *so = ctx->so;
|
||||
unsigned imm_ncomp, swiz, idx, i, j;
|
||||
unsigned idx, i, j;
|
||||
unsigned imm_ncomp = 0;
|
||||
unsigned swiz = 0;
|
||||
uint32_t *value = (uint32_t *)value_f;
|
||||
|
||||
/* try to merge with existing immediate (TODO: try with neg) */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue