From: Eric Anholt Date: Thu, 9 Apr 2020 22:10:08 +0000 (-0700) Subject: util/ra: Sanity check that we're adding a valid reg to a class. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1de267a21acacc4c77bbb94127bfbf1caa4bfc8;p=mesa.git 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 Part-of: --- 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++; }