From: Andrey Tuganov Date: Thu, 2 Mar 2017 22:24:29 +0000 (-0500) Subject: Validator: unique type check allows runtime arrays X-Git-Tag: upstream/2018.6~948 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11fbe5dc1f764d99e27a7049e2cbcd59915846c5;p=platform%2Fupstream%2FSPIRV-Tools.git Validator: unique type check allows runtime arrays OpTypeRuntimeArray is an aggregate and therefore can have duplicate declarations. --- diff --git a/source/validate_type_unique.cpp b/source/validate_type_unique.cpp index c0dbeca..a7f4b9e 100644 --- a/source/validate_type_unique.cpp +++ b/source/validate_type_unique.cpp @@ -30,7 +30,8 @@ spv_result_t TypeUniquePass(ValidationState_t& _, const spv_parsed_instruction_t* inst) { const SpvOp opcode = static_cast(inst->opcode); if (spvOpcodeGeneratesType(opcode)) { - if (opcode == SpvOpTypeArray || opcode == SpvOpTypeStruct) { + if (opcode == SpvOpTypeArray || opcode == SpvOpTypeRuntimeArray || + opcode == SpvOpTypeStruct) { // Duplicate declarations of aggregates are allowed. return SPV_SUCCESS; } diff --git a/test/val/val_type_unique_test.cpp b/test/val/val_type_unique_test.cpp index 9dd44ed..2330582 100644 --- a/test/val/val_type_unique_test.cpp +++ b/test/val/val_type_unique_test.cpp @@ -59,6 +59,8 @@ OpMemoryModel Logical GLSL450 %struct2 = OpTypeStruct %floatt %floatt %vec3t %false = OpConstantFalse %boolt %true = OpConstantTrue %boolt +%runtime_arrayt = OpTypeRuntimeArray %floatt +%runtime_arrayt2 = OpTypeRuntimeArray %floatt )"; return header;