kripken/emscripten — Issue #224: A variable's definition in the .ll file gets removed when it's compiled to Javascript
Author: ehsan
Created: 2012-02-08 16:25:23+00:00
State: open

I saw this in test_poppler in my use_ar branch with https://github.com/kripken/emscripten/commit/cd7d64a1945a7309804008feead7ebe4acb5a722 cherry-picked on top of it. I get the following error when running test_poppler:

`ReferenceError: $mask45 is not defined
at __ZN4XRef8readXRefEPjPNSt3__16vectorIjNS1_9allocatorIjEEEE (/tmp/emscripten_temp/src.cpp.o.js:91896:24)
at __ZN4XRefC2EP10BaseStreamjjPbb (/tmp/emscripten_temp/src.cpp.o.js:91184:15)
at __ZN6PDFDoc5setupEP9GooStringS1_ (/tmp/emscripten_temp/src.cpp.o.js:27520:7)
at __ZN6PDFDocC2EP9GooStringS1_S1_Pv (/tmp/emscripten_temp/src.cpp.o.js:27151:15)
at Array.__ZN18LocalPDFDocBuilder11buildPDFDocERK9GooStringPS0_S3_Pv [as 1146] (/tmp/emscripten_temp/src.cpp.o.js:126119:7)
at _main (/tmp/emscripten_temp/src.cpp.o.js:5086:37)
at Object.callMain (/tmp/emscripten_temp/src.cpp.o.js:298486:10)
at run (/tmp/emscripten_temp/src.cpp.o.js:314566:18)
at Object. (/tmp/emscripten_temp/src.cpp.o.js:314602:7)
at Module._compile (module.js:432:26)`

The ll file can be found here: http://people.mozilla.org/~eakhgari/emcc-2-ll.ll.gz. The generated js file can be found here: http://people.mozilla.org/~eakhgari/src.cpp.o.js.gz. Looks like the definition of $mask45 in the ll file:

`%mask45 = and i224 %mask50, 2041694181243221177147023964717067534335, !dbg !123780`

is somehow getting lost during the translation.