In this case std::array doesn't behave like a regular array, therefore
it is NOT okay to index it outside the array, even though std::fill
needs us to do so.
Change the syntax to do the same thing slightly differently,
and add an assertion to make sure the registers are always within
the array's bounds.
Closes: #5289
Fixes:
0e4747d3fb7ec15f8c1d6b971b1352249e7d95c6
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12664>
if (def.regClass().is_subdword())
idx = clobbered;
+ assert((r + dw_size) <= max_reg_cnt);
assert(def.size() == dw_size || def.regClass().is_subdword());
std::fill(&ctx.instr_idx_by_regs[ctx.current_block->index][r],
- &ctx.instr_idx_by_regs[ctx.current_block->index][r + dw_size], idx);
+ &ctx.instr_idx_by_regs[ctx.current_block->index][r] + dw_size, idx);
}
}