-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
reproducable wasm32 bug #85580
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessO-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessO-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm really sorry if this isn't a compiler bug, but it smells like one. I've managed to bag it into a few lines of code. Change or reorder anything and the test will pass.
If you run
cargo testthis repo it will pass:https://github.com/gilescope/wasm-repro1.git
If you add in
--target=wasm32-unknown-unknownit will fail. ( You will need tocargo install wasm-bindgen-cli)It seems to correctly figure out that the condion is false but then take the true branch of the if anyway. There's no unsafe in the code so there should be no UB....
Why for instance does
<< 0have to be there for the bug to manifest itself? I am clueless...This is with the latest nightly ( rustc 1.54.0-nightly (5dc8789 2021-05-21) ), but have confirmed it fails on beta too.
I would love to know what is going on - it seems very wierd behaviour.