Bug 272902
Summary: | [WASM] Avoid undefined behavior from negating INT_MIN in BBQ | ||
---|---|---|---|
Product: | WebKit | Reporter: | David Degazio <d_degazio> |
Component: | WebAssembly | Assignee: | David Degazio <d_degazio> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
David Degazio
When we're generating code for certain arithmetic instructions in BBQ, notably integer subtract, we detect if one of the operands is a constant can turn that into adding a negative. This works, but it's a bit unsavory in certain edge cases, specifically in the case where the negated constant is the negative numeric limit - this is signed overflow and undefined by the C++ standard, so we should handle it explicitly. I'm pretty sure this has no bearing on our actual runtime behavior on any platform I'm aware of though.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/126695782>
David Degazio
Pull request: https://github.com/WebKit/WebKit/pull/27452
David Degazio
Actually gonna dupe this to my other bug for generally improving isel - it was pointed out that we can avoid ever doing this negation in the first place as long as we can rely on sub32/64 having good lowerings, so let's just change sub32/64 in the macro assembler.
*** This bug has been marked as a duplicate of bug 272901 ***