Mesa (7.9): linker: Fix off-by-one error implicit array sizing
Ian Romanick
idr at kemper.freedesktop.org
Tue Mar 1 00:04:40 UTC 2011
Module: Mesa
Branch: 7.9
Commit: 7be5744b5b53f385c27ddbcec0b6bc6ecb394706
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7be5744b5b53f385c27ddbcec0b6bc6ecb394706
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Tue Feb 15 18:17:53 2011 -0800
linker: Fix off-by-one error implicit array sizing
Arrays are zero based. If the highest element accessed is 6, the
array needs to have 7 elements.
Fixes piglit test glsl-fs-implicit-array-size-03 and bugzilla #34198.
NOTE: This is a candidate for the 7.9 and 7.10 branches.
(cherry picked from commit 25b36e8ff81a9c951085d6dd802a7534db476f5a)
---
src/glsl/linker.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 5f3b062..2db0cae 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -886,7 +886,7 @@ link_intrastage_shaders(void *mem_ctx,
if (var->type->is_array() && (var->type->length == 0)) {
const glsl_type *type =
glsl_type::get_array_instance(var->type->fields.array,
- var->max_array_access);
+ var->max_array_access + 1);
assert(type != NULL);
var->type = type;
More information about the mesa-commit
mailing list