aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-09 15:18:28 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-09 15:18:28 -0700
commit5bbcaa3df570328e568131d8d65aaeb5581942a3 (patch)
tree00f816a907caf7048f9dbfab20a2e72d9c9220ff
parentfee203ed899368e0bd0d6bd6c88c72b0ca8d74e8 (diff)
do not modify textual memory initializer when emitting source maps, as it messes up line numbers; fixes #2410
-rwxr-xr-xemcc2
-rw-r--r--tests/test_core.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/emcc b/emcc
index 0dfa5d86..20f04dd1 100755
--- a/emcc
+++ b/emcc
@@ -1694,7 +1694,7 @@ try:
logging.debug('wrote memory initialization to %s', memfile)
else:
logging.debug('did not see memory initialization')
- elif shared.Settings.USE_TYPED_ARRAYS == 2 and not shared.Settings.MAIN_MODULE and not shared.Settings.SIDE_MODULE:
+ elif shared.Settings.USE_TYPED_ARRAYS == 2 and not shared.Settings.MAIN_MODULE and not shared.Settings.SIDE_MODULE and debug_level < 4:
# not writing a binary init, but we can at least optimize them by splitting them up
src = open(final).read()
src = shared.JS.optimize_initializer(src)
diff --git a/tests/test_core.py b/tests/test_core.py
index b9057f4e..0ec0320e 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -6386,10 +6386,15 @@ def process(filename):
if (i < 10) throw i; // line 5
}
+ #include <iostream>
+ #include <string>
+
int main() {
+ std::string x = "ok"; // add libc++ stuff to make this big, test for #2410
int i;
scanf("%d", &i);
foo(i);
+ std::cout << x << std::endl;
return 0;
}
'''