radeonsi: out of bounds access/compiler warning
While building si_state.c.o on fedora 34/gcc 11
[234/324] Compiling C object src/gallium/drivers/radeonsi/libradeonsi.a.p/si_state.c.o
../src/gallium/drivers/radeonsi/si_state.c: In function ‘si_create_vertex_state’:
../src/gallium/drivers/radeonsi/si_state.c:4954:12: warning: array subscript ‘struct si_context[0]’ is partly outside array bounds of ‘struct pipe_context[1]’ [-Warray-bounds]
4954 | if (sctx->vertex_elements == state)
| ~~~~^~~~~~~~~~~~~~~~~
../src/gallium/drivers/radeonsi/si_state.c:5055:24: note: while referencing ‘ctx’
5055 | struct pipe_context ctx = {};
It looks correct you allocate a ctx on the stack, but then pass it to something which casts it to an si_context which seems like things would just be accessing stack memory randomly then.
Edited by Dave Airlie