nvc0/ir: Initialize CodeEmitterNVC0 member progType in constructor.
authorVinson Lee <vlee@freedesktop.org>
Sun, 13 Jun 2021 23:57:32 +0000 (16:57 -0700)
committerVinson Lee <vlee@freedesktop.org>
Thu, 17 Jun 2021 05:23:52 +0000 (22:23 -0700)
Fix defect reported by Coverity Scan.

Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member progType is not initialized
in this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11350>

src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp

index 8359920..825d7f0 100644 (file)
@@ -29,14 +29,12 @@ namespace nv50_ir {
 class CodeEmitterNVC0 : public CodeEmitter
 {
 public:
-   CodeEmitterNVC0(const TargetNVC0 *);
+   CodeEmitterNVC0(const TargetNVC0 *, Program::Type);
 
    virtual bool emitInstruction(Instruction *);
    virtual uint32_t getMinEncodingSize(const Instruction *) const;
    virtual void prepareEmission(Function *);
 
-   inline void setProgramType(Program::Type pType) { progType = pType; }
-
 private:
    const TargetNVC0 *targNVC0;
 
@@ -3519,9 +3517,10 @@ CodeEmitterNVC0::prepareEmission(Function *func)
       calculateSchedDataNVC0(targ, func);
 }
 
-CodeEmitterNVC0::CodeEmitterNVC0(const TargetNVC0 *target)
+CodeEmitterNVC0::CodeEmitterNVC0(const TargetNVC0 *target, Program::Type type)
    : CodeEmitter(target),
      targNVC0(target),
+     progType(type),
      writeIssueDelays(target->hasSWSched)
 {
    code = NULL;
@@ -3532,8 +3531,7 @@ CodeEmitterNVC0::CodeEmitterNVC0(const TargetNVC0 *target)
 CodeEmitter *
 TargetNVC0::createCodeEmitterNVC0(Program::Type type)
 {
-   CodeEmitterNVC0 *emit = new CodeEmitterNVC0(this);
-   emit->setProgramType(type);
+   CodeEmitterNVC0 *emit = new CodeEmitterNVC0(this, type);
    return emit;
 }