summaryrefslogtreecommitdiff
path: root/ir.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-04-01 18:31:11 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-01 18:35:08 -0700
commitb8a21cc6df7e9da15a24ed3dbf60cd4aeb8effaa (patch)
tree35093f0e280535046c4784b24b2c7f73b271fea2 /ir.h
parent27e3cf8c0d8812f9be55ca6ceb52cf8232742d99 (diff)
Track max accessed array element, reject additional out-of-bounds accesses
For unsized arrays, we can't flag out-of-bounds accesses until the array is redeclared with a size. Track the maximum accessed element and generate an error if the declaration specifies a size that would cause that access to be out-of-bounds. This causes the following tests to pass: glslparsertest/shaders/array10.frag
Diffstat (limited to 'ir.h')
-rw-r--r--ir.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ir.h b/ir.h
index de6f093..8892f1d 100644
--- a/ir.h
+++ b/ir.h
@@ -121,6 +121,7 @@ public:
{
ir_variable *var = new ir_variable(type, name);
+ var->max_array_access = this->max_array_access;
var->read_only = this->read_only;
var->centroid = this->centroid;
var->invariant = this->invariant;
@@ -132,6 +133,13 @@ public:
const char *name;
+ /**
+ * Highest element accessed with a constant expression array index
+ *
+ * Not used for non-array variables.
+ */
+ unsigned max_array_access;
+
unsigned read_only:1;
unsigned centroid:1;
unsigned invariant:1;