From a1de267a21acacc4c77bbb94127bfbf1caa4bfc8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Apr 2020 15:10:08 -0700 Subject: [PATCH] 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: --- 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++; } -- 2.30.2