diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-18 20:50:26 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-18 20:50:26 -0500 |
commit | 45f8f9c948c5548665438827e3d6b39a40eca06e (patch) | |
tree | 3c59d2e107c8029ae240c65c060283c8b89a3e4a | |
parent | c5d546a87d38ef07a7b98edba472c4599decd35f (diff) |
generate valid code for segfaulting loads, not assignless aborts
-rw-r--r-- | src/jsifier.js | 4 | ||||
-rw-r--r-- | tests/test_core.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index fdde8dfb..ceb5c09f 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1331,11 +1331,11 @@ function JSify(data, functionsOnly, givenFunctions) { switch (impl) { case VAR_NATIVIZED: { if (isNumber(item.ident)) { - item.assignTo = null; // Direct read from a memory address; this may be an intentional segfault, if not, it is a bug in the source if (ASM_JS) { - return 'abort(' + item.ident + ')'; + return asmCoercion('abort(' + item.ident + ')', 'i32'); } else { + item.assignTo = null; return 'throw "fault on read from ' + item.ident + '";'; } } diff --git a/tests/test_core.py b/tests/test_core.py index 05f3acc6..4c17a942 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5046,7 +5046,7 @@ The current type of b is: 9 src = r''' int main () { *(volatile char *)0 = 0; - return 0; + return *(volatile char *)0; } ''' self.do_run(src, 'fault on write to 0' if not Settings.ASM_JS else 'abort()') |