kripken/emscripten — Issue #167: TypeError: Cannot call method 'substr' of undefined
Author: jterrace
Created: 2012-01-09 23:57:28+00:00
State: open

When I run emcc with ``-O0 --typed-arrays 0``, I get a working translation, but when I run it with ``-O1 --typed-arrays 0``, I'm getting this error:

parseTools.js:1588: TypeError: Cannot call method 'substr' of undefined
r bitsLeft = parseInt((item.param2 ? item.param2.ident : item.type).substr(1))
^
TypeError: Cannot call method 'substr' of undefined
at processMathop (parseTools.js:1588:73)
at Object.processItem (jsifier.js:703:19)
at Object.process (framework.js:248:26)
at Object.solve (framework.js:184:25)
at JSify (jsifier.js:1183:27)
at JSify (jsifier.js:123:5)
at /disk/local/jterrace/js.js/external/emscripten/src/compiler.js:190:1

Here is a zip of the LLVM and JS files (warning: it's big):
http://www.cs.princeton.edu/~jterrace/temp/optimizer_bug_01092012.tgz

Any idea what's going wrong here?