-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/
Description
I've reported an upstream LLVM bug for this but I want to track it on our side as well to track pulling in the fix. The gist of the issue is that this code:
extern {
fn return_one() -> u32;
fn panic() -> !;
}
#[no_mangle]
pub unsafe extern fn test() {
let tmp: bool = !(return_one() == 1);
if tmp { panic() }
if !tmp { panic() }
}will execute successfully when compiled at O0:
<html>
<head>
<script>
const imports = {
env: {
return_one: function() { return 1; },
panic: function() { throw 'bad'; }
}
};
fetch('foo.wasm')
.then(r => r.arrayBuffer())
.then(r => WebAssembly.instantiate(r, imports))
.then(m => {
console.log('start');
m.instance.exports.test()
console.log('end');
})
.catch(e => console.error(e));
</script>
</head>
<body>
</body>
</html>And it should certainly panic!
I'm currently hoping we can fix this upstream in LLVM before we need to work around it in rustc!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/