aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jsifier.js6
-rwxr-xr-xtests/runner.py3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 3483b8b1..53d23140 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -914,7 +914,11 @@ function JSify(data, functionsOnly, givenFunctions) {
case VAR_NATIVIZED:
if (isNumber(item.ident)) {
// Direct write to a memory address; this may be an intentional segfault, if not, it is a bug in the source
- return 'throw "fault on write to ' + item.ident + '";';
+ if (ASM_JS) {
+ return 'abort(' + item.ident + ')';
+ } else {
+ return 'throw "fault on write to ' + item.ident + '";';
+ }
}
return item.ident + '=' + value + ';'; // We have the actual value here
break;
diff --git a/tests/runner.py b/tests/runner.py
index bf6986db..ce5f346a 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4048,7 +4048,6 @@ The current type of b is: 9
self.do_run(src, 'time: ') # compilation check, mainly
def test_intentional_fault(self):
- if Settings.ASM_JS: return self.skip('no throw support in asm')
# Some programs intentionally segfault themselves, we should compile that into a throw
src = r'''
int main () {
@@ -4056,7 +4055,7 @@ The current type of b is: 9
return 0;
}
'''
- self.do_run(src, 'fault on write to 0')
+ self.do_run(src, 'fault on write to 0' if not Settings.ASM_JS else 'Assertion: 0')
def test_trickystring(self):
src = r'''