From 3ebb72cc7429f0ab8218104dc3687c659c0f364d Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Thu, 22 Jun 2023 16:11:29 -0400 Subject: [PATCH] Add an assert that ID operands are non-zero Zero is not a valid ID value and the SPIR-V emitter library should never be emitting instructions with ID values of 0. --- SPIRV/spvIR.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPIRV/spvIR.h b/SPIRV/spvIR.h index 660742a7..5cbffec2 100644 --- a/SPIRV/spvIR.h +++ b/SPIRV/spvIR.h @@ -97,6 +97,8 @@ public: explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { } virtual ~Instruction() {} void addIdOperand(Id id) { + // ids can't be 0 + assert(id); operands.push_back(id); idOperand.push_back(true); }