[Webkit-unassigned] [Bug 188460] [CMake] Add ENABLE_UNDEFINED_BEHAVIOR_SANITIZER to make it easier to build with UBSan

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 10 09:06:31 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=188460

--- Comment #9 from Michael Catanzaro <mcatanzaro at igalia.com> ---
Konstantin beat me to this by a minute, but I'll post this anyway:

(In reply to Jonathan Bedard from comment #7)
> Completely avoiding all behavior UBSan flags will likely be controversial.
> As an example, (if I'm remember correctly, been a while since I worked with
> this) signed integer overflow is undefined behavior according to the C++
> standards

Yes.

> but in practice, most compilers DO define this behavior so there
> are a few spots where we do (or perhaps did) rely on this being defined
> behavior.

For GCC and Clang this is true only if building with -fwrapv, which we do not use in WebKit:

       -fwrapv
           This option instructs the compiler to assume that signed arithmetic
           overflow of addition, subtraction and multiplication wraps around
           using twos-complement representation.  This flag enables some
           optimizations and disables others.  The options -ftrapv and -fwrapv
           override each other, so using -ftrapv -fwrapv on the command-line
           results in -fwrapv being effective.  Note that only active options
           override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
           results in -ftrapv being effective.

If any of our code assumes twos-complement overflow, I think that would be a bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180810/dca01d05/attachment.html>


More information about the webkit-unassigned mailing list