Module: Mesa Branch: master Commit: a1de267a21acacc4c77bbb94127bfbf1caa4bfc8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1de267a21acacc4c77bbb94127bfbf1caa4bfc8
Author: Eric Anholt <[email protected]> Date: Thu Apr 9 15:10:08 2020 -0700 util/ra: Sanity check that we're adding a valid reg to a class. BITSET_SET might not segfault on you right away if you're just slightly off, and an assert is nicer anyway. Reviewed-by: Kenneth Graunke <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4537> --- src/util/register_allocate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c index a65b5ea154f..68d4a13ca1e 100644 --- a/src/util/register_allocate.c +++ b/src/util/register_allocate.c @@ -371,6 +371,8 @@ ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r) { struct ra_class *class = regs->classes[c]; + assert(r < regs->count); + BITSET_SET(class->regs, r); class->p++; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
