Bug 196829 - Enable -fwrapv and /d2UndefIntOverflow
Summary: Enable -fwrapv and /d2UndefIntOverflow
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-11 14:29 PDT by Yusuke Suzuki
Modified: 2019-04-12 00:45 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2019-04-11 14:29:27 PDT
We already see a bug caused by signed integer overflow UB.
If it does not hurt performance, we should enable this option to avoid such an UB.
Personally, I think this UB is one of the most common UBs resulting in an actual bug.

An attempt making this behavior by default in the spec exists[1].
While the main focus of that proposal is accepted, "making signed overflow well-defined" is rejected.
So we should enable -fwrapv / d2UndefIntOverflow manually in the WebKit side.

> Status-quo If a signed operation would naturally produce a value that is not within the range of the result type, the behavior is undefined.
> The author had hoped to make this well-defined as wrapping (the operations produce the same value bits as for the corresponding unsigned type), but WG21 had strong resistance against this.

[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0907r2.html
Comment 1 Yusuke Suzuki 2019-04-11 15:15:40 PDT
Maybe, this would be my weekend task just for fun.