[PATCH] jscript: Force base type of _jsval_t to be ULONGLONG instead of double.

Jacek Caban jacek at codeweavers.com
Fri Apr 2 07:26:23 CDT 2021


Hi Dmitry,

On 4/2/21 8:19 AM, Dmitry Timoshkov wrote:
> Hi Jacek,
> 
> Jacek Caban <jacek at codeweavers.com> wrote:
> 
>>>>> Gabriel Ivăncescu <gabrielopcode at gmail.com> wrote:
>>>>>
>>>>>> Looks like a bug in Clang to me, although working around it is fine, but
>>>>>> it's not my call.
>>>>>>
>>>>>> Nevertheless I think you should report it to Clang so they fix it.
>>>>> Why do you think that it's a clang bug? Using fldl + fstpl to store and
>>>>> fetch the double to/from the floating point stack is perfectly legitimate.
>>>>>
>>>> Well, because jsval_t is a union, not a double. Shouldn't assignment be
>>>> a bitwise copy? The compiler can't know what actual type is used by the
>>>> union here. Unless I misremember the C standard.
>>> If I understand correctly, the compiler have chosen the memeber of
>>> a maximal bits width and used it for a copy. That's unfortunate that
>>> the chosen member happened to be of type 'double', and as a result
>>> floating point instructions were used to perform the copying operation.
>>
>>
>> Compiler is free to use any copy implementation it wants, but it can't
>> affect stored values. If it changes stored values, it's obviously a
>> compiler bug. But it would be good to understand what's exactly going on
>> before jumping to that conclusion. From your description, I don't yet
>> see the exact problem. I also can't reproduce it with my builds. Could
>> you please send me your jscript.dll build?
> 
> Did you find anything useful in jscript.dll that I sent you?

The good news is that I managed to reproduce it locally, so I could 
experiment with it. I'm leaning towards a solution like (a cleaner 
version of) the attached patch. It fixes the problem for me. I'm not yet 
sure about that, it needs another look, but it would be interesting to 
confirm that it works for you.

Jacek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jsval.diff
Type: text/x-patch
Size: 2444 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210402/044b9cb6/attachment.bin>


More information about the wine-devel mailing list