diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-29 14:54:21 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-29 14:59:16 -0700 |
commit | 61526bc8b6eca8950e34616fc9cad2212c18abe6 (patch) | |
tree | dd559f9b17465732b4e870d02b450b81a88f03bd | |
parent | 82cafff17306df64c31224c1e343458a6096ff36 (diff) |
accept [0 x ..] in the middle of structures, odd as it might seem, this is valid c
-rw-r--r-- | src/parseTools.js | 7 | ||||
-rw-r--r-- | src/runtime.js | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 72166592..b7d3ea91 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -970,10 +970,9 @@ function generateStructTypes(type) { ret[index++] = type; } else { if (Runtime.isStructType(type) && type[1] === '0') { - // this is [0 x something]. When inside another structure like here, it must be at the end, - // and it does nothing - assert(i === typeData.fields.length-1); - return; + // this is [0 x something], which does nothing + // XXX this happens in java_nbody... assert(i === typeData.fields.length-1); + continue; } add(Types.types[type]); } diff --git a/src/runtime.js b/src/runtime.js index 8c2c8f4d..e07d5054 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -212,7 +212,7 @@ var Runtime = { if (field[1] === '0') { // this is [0 x something]. When inside another structure like here, it must be at the end, // and it adds no size - assert(index === type.fields.length); + // XXX this happens in java-nbody for example... assert(index === type.fields.length, 'zero-length in the middle!'); size = 0; alignSize = type.alignSize || QUANTUM_SIZE; } else { |