Skip to content

Commit aaa9485

Browse files
authored
Initialize output parameter of spvtools::LookupOperand (KhronosGroup#6223)
1 parent e7d92f7 commit aaa9485

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

source/binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ void Parser::recordNumberType(size_t inst_offset,
856856
info.type = SPV_NUMBER_FLOATING;
857857
info.bit_width = peekAt(inst_offset + 2);
858858
if (inst->num_words >= 4) {
859-
const spvtools::OperandDesc* desc;
859+
const spvtools::OperandDesc* desc = nullptr;
860860
spv_result_t status = spvtools::LookupOperand(
861861
SPV_OPERAND_TYPE_FPENCODING, peekAt(inst_offset + 3), &desc);
862862
if (status == SPV_SUCCESS) {

source/text_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ spv_result_t AssemblyContext::recordTypeDefinition(
336336
return diagnostic() << "Invalid OpTypeFloat instruction";
337337
spv_fp_encoding_t enc = SPV_FP_ENCODING_UNKNOWN;
338338
if (pInst->words.size() >= 4) {
339-
const spvtools::OperandDesc* desc;
339+
const spvtools::OperandDesc* desc = nullptr;
340340
spv_result_t status = spvtools::LookupOperand(SPV_OPERAND_TYPE_FPENCODING,
341341
pInst->words[3], &desc);
342342
if (status == SPV_SUCCESS) {

source/val/validate_type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ spv_result_t ValidateTypeFloat(ValidationState_t& _, const Instruction* inst) {
140140
return _.diag(SPV_ERROR_INVALID_DATA, inst)
141141
<< "8-bit floating point type requires an encoding.";
142142
}
143-
const spvtools::OperandDesc* desc;
143+
const spvtools::OperandDesc* desc = nullptr;
144144
const std::set<spv::FPEncoding> known_encodings{
145145
spv::FPEncoding::Float8E4M3EXT, spv::FPEncoding::Float8E5M2EXT};
146146
spv_result_t status = spvtools::LookupOperand(SPV_OPERAND_TYPE_FPENCODING,

0 commit comments

Comments
 (0)