generate valid code for segfaulting loads, not assignless aborts
This commit is contained in:
Родитель
c5d546a87d
Коммит
45f8f9c948
|
@ -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 + '";';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()')
|
||||
|
|
Загрузка…
Ссылка в новой задаче