RFR: 8145096: Undefined behaviour in HotSpot

Andrew Haley aph at redhat.com
Thu Dec 17 10:12:35 UTC 2015

On 17/12/15 00:26, Kim Barrett wrote:

> I think we're all agreed that John's reinterpret_cast suggestion is
> the way to go, but for the record, there happens to be a parallel
> discussion of the union trick occurring on another mailing list I'm
> on.  It's reported there that C11 allows the union trick.  Also
> reported that discussion within the C++ committee has deemed it a
> bad idea for C++, and that there exist compilers which generate
> "bogus" code for the union trick, though no details were given.

So, what we have here is a portability problem between C and C++.  I'm
surprised, to be honest, because I thought that the TCs were getting
together to try to reduce the divergence.  Especially in this case,
given that the union trick is common practice, it makes no sense to
have such a difference.

I'm sure the authors of such compilers are not helping their users at


More information about the hotspot-dev mailing list