summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2014-09-05 20:59:32 -0400
committerAndreas Boll <[email protected]>2014-09-12 16:07:47 +0200
commit2828680e39e843514a38781878e2a3534f876233 (patch)
tree5439ab520a1749dc0d113a1e8f43db30e0c9cc02
parentec046bc08ef8ccf69e867635c7d1e2e032acce36 (diff)
ra: assert against unsigned underflow in q_total
q_total should never go below 0 (which is why it's defined as unsigned), and if it does, then something is seriously wrong. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/program/register_allocate.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c
index db2be5dfad4..7faf67215c8 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -434,6 +434,7 @@ decrement_q(struct ra_graph *g, unsigned int n)
unsigned int n2_class = g->nodes[n2].class;
if (n != n2 && !g->nodes[n2].in_stack) {
+ assert(g->nodes[n2].q_total >= g->regs->classes[n2_class]->q[n_class]);
g->nodes[n2].q_total -= g->regs->classes[n2_class]->q[n_class];
}
}