RFR: 8145096: Undefined behaviour in HotSpot
john.r.rose at oracle.com
Fri Dec 11 18:17:18 UTC 2015
On Dec 11, 2015, at 1:58 AM, Andrew Haley <aph at redhat.com> wrote:
> On 12/10/2015 09:44 PM, Kim Barrett wrote:
>> To me, this seems to be trading one form of undefined behavior for
>> another. Since there *is* a portable solution, which I understand is
>> also well supported / optimized by compilers, I'd prefer that.
> OK. I'm not convinced that a memcpy is into a signed int is really
> more perfectly portable than a union, but I'm certain it will work for
> the machines we care about. I'm not going to argue about it if that's
> what you prefer: I just want the bugs to be fixed!
C++ has several flavors of cast; is there not one that will reinterpret the bits,
leaving them unchanged? The union and memcpy guys are (AFAIK) equally
awkward ways to express that intention, but I thought reinterpret_cast was
the most direct way to do the job.
More information about the hotspot-dev