From 3f290b4f650b2e06bf2da25be8ad1f593c920fc1 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 26 Jan 2021 14:30:28 -0500 Subject: [PATCH] nouveau: Silence a warning at -Og MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp: In member function ‘void nv50_ir::AlgebraicOpt::handleCVT_EXTBF(nv50_ir::Instruction*)’: ../src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp:2238:57: warning: ‘offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] Just set it to 0 to handle the corner case. Reviewed-by: Eric Anholt Reviewed-by: Karol Herbst Part-of: --- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index f5514c6f5fd..6da706b79b1 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -2167,7 +2167,7 @@ AlgebraicOpt::handleCVT_EXTBF(Instruction *cvt) Instruction *insn = cvt->getSrc(0)->getInsn(); ImmediateValue imm; Value *arg = NULL; - unsigned width, offset; + unsigned width, offset = 0; if ((cvt->sType != TYPE_U32 && cvt->sType != TYPE_S32) || !insn) return; if (insn->op == OP_EXTBF && insn->src(1).getImmediate(imm)) { @@ -2199,7 +2199,7 @@ AlgebraicOpt::handleCVT_EXTBF(Instruction *cvt) arg = insn->getSrc(!s); Instruction *shift = arg->getInsn(); - offset = 0; + if (shift && shift->op == OP_SHR && shift->sType == cvt->sType && shift->src(1).getImmediate(imm) &&