nv50/codegen: do not emitATOM() if the subOp is unknown
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 11 Apr 2013 23:22:30 +0000 (00:22 +0100)
committerChristoph Bumiller <christoph.bumiller@speed.at>
Fri, 12 Apr 2013 15:08:26 +0000 (17:08 +0200)
For debug build we'll hit the assert, for release we are going to emit random data
as subOp is used uninitilised. Spotted by gcc

codegen/nv50_ir_emit_nv50.cpp: In member function 'void nv50_ir::CodeEmitterNV50::emitATOM(const nv50_ir::Instruction*)':
codegen/nv50_ir_emit_nv50.cpp:1554:12: warning: 'subOp' may be used uninitialized in this function [-Wmaybe-uninitialized]
    uint8_t subOp;
            ^

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
src/gallium/drivers/nv50/codegen/nv50_ir_emit_nv50.cpp

index 2638ef1399d8708b3bd6aafd80518ac3e51b921b..bc5a833743b2a56a30ce3a473006b90086cbcb5d 100644 (file)
@@ -1565,7 +1565,7 @@ CodeEmitterNV50::emitATOM(const Instruction *i)
    case NV50_IR_SUBOP_ATOM_EXCH: subOp = 0x1; break;
    default:
       assert(!"invalid subop");
-      break;
+      return;
    }
    code[0] = 0xd0000001;
    code[1] = 0xe0c00000 | (subOp << 2);