[Webkit-unassigned] [Bug 232951] Prevent fused multiply add during ParseInt

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 10 10:51:29 PST 2021


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

Yusuke Suzuki <ysuzuki at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ysuzuki at apple.com
 Attachment #443833|review?                     |review-
              Flags|                            |

--- Comment #3 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 443833
  --> https://bugs.webkit.org/attachment.cgi?id=443833
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=443833&action=review

Commented.

> Source/JavaScriptCore/ChangeLog:18
> +        When parsing the string in parseInt, a compiler can wrongfully generate
> +        a fused multiply-add instruction, causing the conversion to be wrong
> +        for some high values. An add followed by a multiply gives the correct
> +        result and it is the code generated most of the times.
> +
> +        This patch adds a volatile qualifier to the number variable, so the
> +        compiler doesn't try to optimize it, and enables a failing test on
> +        mips.
> +
> +        The issue was found when cross compiling to mips with gcc 8.4.0 and
> +        options -ffp-contract=off -mmadd4.

This is GCC issue, and we should not use `volatile` here. We should disable GCC's this optimization for this function via pragma etc.
https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Specific-Option-Pragmas.html#Function-Specific-Option-Pragmas
https://stackoverflow.com/questions/34436233/fused-multiply-add-and-default-rounding-modes

-- 
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/20211110/fb308bce/attachment.htm>


More information about the webkit-unassigned mailing list