Mesa (master): aco: fix p_extract_vector validation

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 14 11:02:56 UTC 2020


Module: Mesa
Branch: master
Commit: e18711cda3bf173e03d9773001f641fd85ffd18d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e18711cda3bf173e03d9773001f641fd85ffd18d

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Apr 10 15:11:03 2020 +0100

aco: fix p_extract_vector validation

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4507>

---

 src/amd/compiler/aco_validate.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp
index 39174971b04..3e0f4584cd3 100644
--- a/src/amd/compiler/aco_validate.cpp
+++ b/src/amd/compiler/aco_validate.cpp
@@ -261,7 +261,7 @@ void validate(Program* program, FILE * output)
                }
             } else if (instr->opcode == aco_opcode::p_extract_vector) {
                check((instr->operands[0].isTemp()) && instr->operands[1].isConstant(), "Wrong Operand types", instr.get());
-               check(instr->operands[1].constantValue() < instr->operands[0].size(), "Index out of range", instr.get());
+               check((instr->operands[1].constantValue() + 1) * instr->definitions[0].bytes() <= instr->operands[0].bytes(), "Index out of range", instr.get());
                check(instr->definitions[0].getTemp().type() == RegType::vgpr || instr->operands[0].regClass().type() == RegType::sgpr,
                      "Cannot extract SGPR value from VGPR vector", instr.get());
             } else if (instr->opcode == aco_opcode::p_parallelcopy) {



More information about the mesa-commit mailing list