mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-07 01:48:20 +02:00
intel/brw: Add assert for error case
Coverity notices that there is an error case where `nir_get_io_data_src_number` could return `-1`, and that is then used to index into an array. Given that that is an exceptional case, we can just assert here. CID: 1681480 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40146>
This commit is contained in:
parent
825df24023
commit
4381ac9a91
1 changed files with 9 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include "util/lut.h"
|
||||
#include "compiler/glsl_types.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <optional>
|
||||
|
||||
struct brw_bind_info {
|
||||
|
|
@ -6002,8 +6003,14 @@ brw_from_nir_emit_memory_access(nir_to_brw_state &ntb,
|
|||
}
|
||||
|
||||
int data_src = nir_get_io_data_src_number(instr);
|
||||
unsigned components = is_store ? instr->src[data_src].ssa->num_components
|
||||
: instr->def.num_components;
|
||||
unsigned components;
|
||||
if (is_store) {
|
||||
assert(data_src >= 0);
|
||||
components = instr->src[data_src].ssa->num_components;
|
||||
} else {
|
||||
components = instr->def.num_components;
|
||||
}
|
||||
|
||||
if (components == 0)
|
||||
components = instr->num_components;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue