From 349cb60ed58e42341351c5f0ebd186acb8f12005 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Sat, 19 Nov 2011 21:31:28 +0100 Subject: [PATCH] nv50/ir: Don't crash on zero sized BitSets. --- src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp index 56d53b48ddd..4eaaa9602c1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp @@ -219,6 +219,7 @@ bool BitSet::allocate(unsigned int nBits, bool zero) if (zero) memset(data, 0, (size + 7) / 8); else + if (nBits) data[(size + 31) / 32 - 1] = 0; // clear unused bits (e.g. for popCount) return data; -- 2.30.2