aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jsifier.js4
-rw-r--r--tests/test_core.py2
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()')