aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-21 12:03:36 -0700
committeralon@honor <none@none>2010-10-21 12:03:36 -0700
commit057289cb695cf7483d5cf54be3d032f11f085fbe (patch)
tree77b29aa2e582775296633755671bd0cde3e9599d
parent4d9d2829c206c2456155087a3150e17fd4c8130f (diff)
properly analyze [0 x ...] types (used only for indexing)
-rw-r--r--src/analyzer.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 80860aa6..96f2d509 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -93,6 +93,11 @@ function analyzer(data) {
var check = new RegExp(/^\[(\d+)\ x\ (.*)\]$/g).exec(nonPointing);
if (check && !data.types[nonPointing]) {
var num = parseInt(check[1]);
+ num = Math.max(num, 1); // [0 x something] is used not for allocations and such of course, but
+ // for indexing - for an |array of unknown length|, basically. So we
+ // define the 'type' as having a single field. TODO: Ensure as a sanity
+ // check that we never allocate with this (either as a child structure
+ // in the analyzer, or in calcSize in alloca).
var subType = check[2];
data.types[nonPointing] = {
name_: nonPointing,