RFR: 8295351: java/lang/Float/Binary16Conversion.java fails with "Unexpected result of converting" [v2]
David Holmes
dholmes at openjdk.org
Thu Nov 24 00:00:22 UTC 2022
On Wed, 23 Nov 2022 22:32:35 GMT, Smita Kamath <svkamath at openjdk.org> wrote:
>> src/hotspot/share/runtime/sharedRuntime.cpp line 455:
>>
>>> 453: union {jfloat f; juint i;} bits;
>>> 454: bits.f = x;
>>> 455: jint doppel = bits.i;
>>
>> Doesn't the conversion from unsigned to signed risk a compiler warning being emitted?
>>
>> Can't you just use the existing `JavaValue` type to perform the union conversion trick?
>
> Hi David, thanks for pointing this out. I have updated the code to use jint.
> I have used the union conversion trick that was previously used in SharedRuntime::drem and SharedRuntime::frem. I hope that's okay with you.
We seem to employ this trick in a few places, e.g. also see metaprogramming/primitiveConversions.hpp. It would be good to reduce that so I will file a separate RFE.
-------------
PR: https://git.openjdk.org/jdk/pull/11301
More information about the hotspot-dev
mailing list