[Webkit-unassigned] [Bug 196533] [META] Undefined behavior bugs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 3 14:07:38 PDT 2019


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

--- Comment #5 from Yusuke Suzuki <ysuzuki at apple.com> ---
(In reply to Filip Pizlo from comment #3)
> The first of those is just not a bug. CPUs we target ignore the high bits of
> a shift amount. This code would only be recompiled if the shift amount ended
> up being a constant.

I think the problem of UB is not CPU related thing. CPU behavior is really nice, and meets our expectation.
Rather, I think the typical UB-related problem is caused because of the C compiler's assumption "dev never does UB" (clearly, it is wrong).
This assumption introduces restriction on some value's range (like, "you are doing "v << x", so, x should be [0, 64), and let's use this information to do further optimizations"), it leads to "aggressively" optimized code, which does not meet our expected behavior.
One of the issue I remember is that https://trac.webkit.org/changeset/195906/webkit, GCC leverages our UB behavior and does "optimizations" which makes B3 broken.

My thought on UB is,

1. If we can easily avoid UB, we should do that.
2. If we require some massively ugly annotations, I don't have strong opinion.
3. If the fix introduces performance regression, we should not accept such a change.

What do you think of?

-- 
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/20190403/7e174fbe/attachment.html>


More information about the webkit-unassigned mailing list